Package org.apache.xmpbox.xml
Class XmpSerializer
java.lang.Object
org.apache.xmpbox.xml.XmpSerializer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DocumentBuilder
private boolean
private final TransformerFactory
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.XmpSerializer
(TransformerFactory transformerFactory, DocumentBuilderFactory documentBuilderFactory) Constructor to be used if other factories than the default ones are needed. -
Method Summary
Modifier and TypeMethodDescriptionprotected Element
createRdfElement
(Document doc, XMPMetadata metadata, boolean withXpacket) private void
fillElementWithAttributes
(Element target, AbstractComplexProperty property) normalizeAttributes
(AbstractComplexProperty property) Normalize the list of attributes.private void
save
(Node doc, OutputStream outStream, String encoding) Save the XML document to an output stream.void
serialize
(XMPMetadata metadata, OutputStream os, boolean withXpacket) void
serializeFields
(Document doc, Element parent, List<AbstractField> fields, String resourceNS, String prefix, boolean wrapWithProperty) protected Element
serializeSchema
(Document doc, XMPSchema schema)
-
Field Details
-
transformerFactory
-
documentBuilder
-
parseTypeResourceForLi
private boolean parseTypeResourceForLi
-
-
Constructor Details
-
XmpSerializer
public XmpSerializer()Default constructor. -
XmpSerializer
public XmpSerializer(TransformerFactory transformerFactory, DocumentBuilderFactory documentBuilderFactory) Constructor to be used if other factories than the default ones are needed.- Parameters:
transformerFactory
- transformer factory to be useddocumentBuilderFactory
- document builder factory to be used
-
-
Method Details
-
serialize
public void serialize(XMPMetadata metadata, OutputStream os, boolean withXpacket) throws TransformerException - Throws:
TransformerException
-
serializeSchema
-
serializeFields
-
fillElementWithAttributes
-
normalizeAttributes
Normalize the list of attributes. Attributes which match a schema property are serialized as child elements so only return the ones which do not match a schema property- Parameters:
property
- the property that needs to be inspected- Returns:
- the list of attributed for serializing
-
createRdfElement
-
save
Save the XML document to an output stream.- Parameters:
doc
- The XML document to save.outStream
- The stream to save the document to.encoding
- The encoding to save the file as.- Throws:
TransformerException
- If there is an error while saving the XML.
-