protected Element createRdfElement(Document doc, XMPMetadata metadata, boolean withXpacket)
{
// starting xpacket
if (withXpacket)
{
ProcessingInstruction beginXPacket = doc.createProcessingInstruction("xpacket",
"begin=\"" + metadata.getXpacketBegin() + "\" id=\"" + metadata.getXpacketId() + "\"");
doc.appendChild(beginXPacket);
}
// meta element
Element xmpmeta = doc.createElementNS("adobe:ns:meta/", "x:xmpmeta");
xmpmeta.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns:x", "adobe:ns:meta/");
doc.appendChild(xmpmeta);
// ending xpacket
if (withXpacket)
{
ProcessingInstruction endXPacket = doc.createProcessingInstruction("xpacket",
"end=\"" + metadata.getEndXPacket() + "\"");
doc.appendChild(endXPacket);
}
// rdf element
Element rdf = doc.createElementNS(XmpConstants.RDF_NAMESPACE, "rdf:RDF");