Package com.lowagie.text.xml.xmp
Class XmpReader
- java.lang.Object
-
- com.lowagie.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
Constructors Constructor Description XmpReader(byte[] bytes)Constructs an XMP reader
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(String parent, String namespaceURI, String localName, String value)Adds a tag.booleanreplace(String namespaceURI, String localName, String value)Replaces the content of a tag.byte[]serializeDoc()Writes the document to a byte array.booleansetNodeText(Document domDocument, Node n, String value)Sets the text of this node.
-
-
-
Constructor Detail
-
XmpReader
public XmpReader(byte[] bytes) throws SAXException, IOExceptionConstructs an XMP reader- Parameters:
bytes- the XMP content- Throws:
ExceptionConverter- on errorIOException- on errorSAXException- on error
-
-
Method Detail
-
replace
public boolean replace(String namespaceURI, String localName, String value)
Replaces the content of a tag.- Parameters:
namespaceURI- the URI of the namespacelocalName- the tag namevalue- 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
-
add
public boolean add(String parent, String namespaceURI, String localName, String value)
Adds a tag.- Parameters:
namespaceURI- the URI of the namespaceparent- the tag name of the parentlocalName- the name of the tag to addvalue- 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- theDocumentthat contains the noden- theNodeto add the text tovalue- the text to add- Returns:
trueif added successfully, elsefalse
-
serializeDoc
public byte[] serializeDoc() throws IOExceptionWrites the document to a byte array.- Returns:
- byte array of serialized doc
- Throws:
IOException- on error
-
-