List of usage examples for com.itextpdf.text.xml.xmp XmpSchema setProperty
public Object setProperty(String key, LangAlt value)
From source file:org.crossref.pdfmark.XmpUtils.java
License:Open Source License
private static void parseRdfElement(Map<String, XmpSchema> schemata, Element ele) { String propertyName = ele.getNodeName(); String[] ns = XmlUtils.getNamespaceDeclaration(ele); XmpSchema schema = null; if (schemata.containsKey(ns[1])) { schema = schemata.get(ns[1]);/*from w w w .j a v a 2 s . c o m*/ } else { schema = new AnyXmpSchema(ns[0], ns[1]); schemata.put(ns[1], schema); } /* Should have either Text or a single <rdf:Bag/Alt/Seq>. */ boolean hasElementChildren = false; for (int i = 0; i < ele.getChildNodes().getLength(); i++) { Node n = ele.getChildNodes().item(i); if (n instanceof Element) { XmpArray ary = parseRdfList((Element) n); schema.setProperty(propertyName, ary); hasElementChildren = true; } } if (!hasElementChildren) { String value = ele.getTextContent(); schema.setProperty(propertyName, value); } /* And attributes... */ NamedNodeMap attribs = ele.getAttributes(); for (int i = 0; i < attribs.getLength(); i++) { Attr attr = (Attr) attribs.item(i); if (!attr.getName().startsWith("xmlns")) { schema.setProperty(attr.getName(), attr.getTextContent()); } } }