(This is Debian bug #605940.) XMP permits only rdf:Description elements directly under rdf:RDF. libxmlgraphics-commons-java does not enforce this and produces some odd results in the XMP (it looks like it treats top-level non-Description elements as properties). These top-level non-rdf:Description elements should either be rejected or turned into rdf:Description elements with rdf:type properties.
Created attachment 26423 [details] Patch to reject top-level typed nodes This patch rejects top-level typed nodes with an exception.
(In reply to comment #1) > Created attachment 26423 [details] > Patch to reject top-level typed nodes > > This patch rejects top-level typed nodes with an exception. + String about = attributes.getValue(XMPConstants.RDF_NAMESPACE, "about"); + if (this.contextStack.peek().equals(this.meta) && (about != null)) { + //rdf:RDF is the parent, so this is a top-level item that isn't + //an rdf:Description, which isn't allowed. + throw new SAXException("Top-level element " + qName + " not an rdf:Description"); + } (1) the check this.contextStack.peek().equals(this.meta) would also return true if xmp:xmpmeta is the parent; (2) that <!{xmp|rdf}:* rdf:about=""> is the same as 'not an rdf:Description' is not clear to me; aren't there other possibilities for 'not an rdf:Description' that do not have rdf:about? could you update patch accordingly, and also provide junit tests that test this new functionality both for absence and presence (see test/java/org/apache/xmlgraphics/xmp/XMPParserTest.java)