Search in sources :

Example 1 with XmpSchemaException

use of org.apache.xmpbox.schema.XmpSchemaException in project pdfbox by apache.

the class DomXmpParser method parseDescriptionRoot.

private void parseDescriptionRoot(XMPMetadata xmp, Element description) throws XmpParsingException {
    nsFinder.push(description);
    TypeMapping tm = xmp.getTypeMapping();
    try {
        List<Element> properties = DomHelper.getElementChildren(description);
        // parse attributes as properties
        NamedNodeMap nnm = description.getAttributes();
        for (int i = 0; i < nnm.getLength(); i++) {
            Attr attr = (Attr) nnm.item(i);
            if (XMLConstants.XMLNS_ATTRIBUTE.equals(attr.getPrefix())) {
            // do nothing
            } else if (XmpConstants.DEFAULT_RDF_PREFIX.equals(attr.getPrefix()) && XmpConstants.ABOUT_NAME.equals(attr.getLocalName())) {
            // do nothing
            } else if (attr.getPrefix() == null && XmpConstants.ABOUT_NAME.equals(attr.getLocalName())) {
            // do nothing
            } else {
                parseDescriptionRootAttr(xmp, description, attr, tm);
            }
        }
        parseChildrenAsProperties(xmp, properties, tm, description);
    } catch (XmpSchemaException e) {
        throw new XmpParsingException(ErrorType.Undefined, "Parsing failed", e);
    } finally {
        nsFinder.pop();
    }
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) Element(org.w3c.dom.Element) TypeMapping(org.apache.xmpbox.type.TypeMapping) XmpSchemaException(org.apache.xmpbox.schema.XmpSchemaException) Attr(org.w3c.dom.Attr)

Aggregations

XmpSchemaException (org.apache.xmpbox.schema.XmpSchemaException)1 TypeMapping (org.apache.xmpbox.type.TypeMapping)1 Attr (org.w3c.dom.Attr)1 Element (org.w3c.dom.Element)1 NamedNodeMap (org.w3c.dom.NamedNodeMap)1