in src/main/java/org/apache/xmlgraphics/xmp/XMPHandler.java [215:302]
public void endElement(String uri, String localName, String qName) throws SAXException {
Attributes atts = (Attributes)attributesStack.pop();
if (XMPConstants.XMP_NAMESPACE.equals(uri)) {
//nop
} else if (XMPConstants.RDF_NAMESPACE.equals(uri) && !"value".equals(localName)) {
if ("li".equals(localName)) {
XMPStructure struct = getCurrentStructure();
String parseType = atts.getValue("rdf:parseType");
if (struct != null) {
//Pop the structure
this.contextStack.pop();
this.nestingInfoStack.pop();
getCurrentArray(true).add(struct, null, parseType);
} else {
String s = content.toString().trim();
if (s.length() > 0) {
String lang = atts.getValue(XMPConstants.XML_NS, "lang");
getCurrentArray(true).add(s, lang, parseType);
} else {
String res = atts.getValue(XMPConstants.RDF_NAMESPACE,
"resource");
if (res != null) {
try {
URI resource = new URI(res);
getCurrentArray(true).add(resource, null, parseType);
} catch (URISyntaxException e) {
throw new SAXException("rdf:resource value is not a well-formed URI", e);
}
}
}
}
} else if ("Description".equals(localName)) {
/*
if (isInStructure()) {
//Description is indicating a structure
//this.currentProperties = (PropertyAccess)propertiesStack.pop();
this.nestingInfoStack.pop();
}*/
} else {
//nop, don't pop stack so the parent element has access
}
} else {
XMPProperty prop;
QName name;
if (hasComplexContent()) {
//Pop content of property
Object obj = this.contextStack.pop();
this.nestingInfoStack.pop();
name = popCurrentPropName();
if (obj instanceof XMPComplexValue) {
XMPComplexValue complexValue = (XMPComplexValue)obj;
prop = new XMPProperty(name, complexValue);
} else {
throw new UnsupportedOperationException("NYI");
}
} else {
name = popCurrentPropName();
String s = content.toString().trim();
prop = new XMPProperty(name, s);
String lang = atts.getValue(XMPConstants.XML_NS, "lang");
String res = atts.getValue(XMPConstants.RDF_NAMESPACE, "resource");
if (lang != null) {
prop.setXMLLang(lang);
}
if (res != null) {
try {
URI resource = new URI(res);
prop.setValue(resource);
} catch (URISyntaxException e) {
throw new SAXException("rdf:resource value is not a well-formed URI", e);
}
}
}
if (prop.getName() == null) {
throw new IllegalStateException("No content in XMP property");
}
if (getCurrentProperties() == null) {
startThinStructure();
}
getCurrentProperties().setProperty(prop);
}
content.setLength(0); //Reset text buffer (see characters())
super.endElement(uri, localName, qName);
}