Package org.apache.xmpbox.xml
Class XmpSerializer
java.lang.Object
org.apache.xmpbox.xml.XmpSerializer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DocumentBuilderprivate booleanprivate 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 ElementcreateRdfElement(Document doc, XMPMetadata metadata, boolean withXpacket) private voidfillElementWithAttributes(Element target, AbstractComplexProperty property) normalizeAttributes(AbstractComplexProperty property) Normalize the list of attributes.private voidsave(Node doc, OutputStream outStream, String encoding) Save the XML document to an output stream.voidserialize(XMPMetadata metadata, OutputStream os, boolean withXpacket) voidserializeFields(Document doc, Element parent, List<AbstractField> fields, String resourceNS, String prefix, boolean wrapWithProperty) protected ElementserializeSchema(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.
-