com.itextpdf.text.xml.xmp
Class XmpReader

java.lang.Object
  extended by com.itextpdf.text.xml.xmp.XmpReader

public class XmpReader
extends Object

Reads an XMP stream into an org.w3c.dom.Document objects. Allows you to replace the contents of a specific tag.

Since:
2.1.3

Constructor Summary
XmpReader(byte[] bytes)
          Constructs an XMP reader
 
Method Summary
 boolean add(String parent, String namespaceURI, String localName, String value)
          Adds a tag.
 boolean replaceDescriptionAttribute(String namespaceURI, String localName, String value)
          Replaces the content of an attribute in the description tag.
 boolean replaceNode(String namespaceURI, String localName, String value)
          Replaces the content of a tag.
 byte[] serializeDoc()
          Writes the document to a byte array.
 boolean setNodeText(Document domDocument, Node n, String value)
          Sets the text of this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmpReader

public XmpReader(byte[] bytes)
          throws SAXException,
                 IOException
Constructs an XMP reader

Parameters:
bytes - the XMP content
Throws:
ExceptionConverter
IOException
SAXException
Method Detail

replaceNode

public boolean replaceNode(String namespaceURI,
                           String localName,
                           String value)
Replaces the content of a tag.

Parameters:
namespaceURI - the URI of the namespace
localName - the tag name
value - the new content for the tag
Returns:
true if the content was successfully replaced
Since:
2.1.6 the return type has changed from void to boolean

replaceDescriptionAttribute

public boolean replaceDescriptionAttribute(String namespaceURI,
                                           String localName,
                                           String value)
Replaces the content of an attribute in the description tag.

Parameters:
namespaceURI - the URI of the namespace
localName - the tag name
value - the new content for the tag
Returns:
true if the content was successfully replaced
Since:
5.0.0 the return type has changed from void to boolean

add

public boolean add(String parent,
                   String namespaceURI,
                   String localName,
                   String value)
Adds a tag.

Parameters:
namespaceURI - the URI of the namespace
parent - the tag name of the parent
localName - the name of the tag to add
value - the new content for the tag
Returns:
true if the content was successfully added
Since:
2.1.6

setNodeText

public boolean setNodeText(Document domDocument,
                           Node n,
                           String value)
Sets the text of this node. All the child's node are deleted and a new child text node is created.

Parameters:
domDocument - the Document that contains the node
n - the Node to add the text to
value - the text to add

serializeDoc

public byte[] serializeDoc()
                    throws IOException
Writes the document to a byte array.

Throws:
IOException


Copyright © 2013. All Rights Reserved.