@@ -1688,4 +1688,48 @@ void testPDFBox6136() throws XmpParsingException
16881688 assertEquals ("B" , xmp .getPDFAIdentificationSchema ().getConformance ());
16891689 assertEquals ((Integer ) 1 , xmp .getPDFAIdentificationSchema ().getPart ());
16901690 }
1691+
1692+ /**
1693+ * PDFBOX-6138: namespaces are in the root, instead of in rdf:RDF or deeper.
1694+ *
1695+ * @throws XmpParsingException
1696+ */
1697+ @ Test
1698+ void testNamespaceInRoot () throws XmpParsingException
1699+ {
1700+ String s =
1701+ "<?xml version=\" 1.0\" encoding=\" utf-8\" standalone=\" no\" ?>\n " +
1702+ "<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>" +
1703+ "<x:xmpmeta xmlns:x=\" adobe:ns:meta/\" xmlns:pdfaExtension=\" http://www.aiim.org/pdfa/ns/extension/\" " +
1704+ "xmlns:pdfaProperty=\" http://www.aiim.org/pdfa/ns/property#\" xmlns:pdfaSchema=\" http://www.aiim.org/pdfa/ns/schema#\" " +
1705+ "xmlns:pdfuaid=\" http://www.aiim.org/pdfua/ns/id/\" xmlns:rdf=\" http://www.w3.org/1999/02/22-rdf-syntax-ns#\" " +
1706+ "x:xmptk=\" Adobe XMP Core 5.6-c015 91.163280, 2018/06/22-11:31:03 \" >\n " +
1707+ " <rdf:RDF>\n " +
1708+ " <rdf:Description rdf:about=\" \" >\n " +
1709+ " <pdfaExtension:schemas>\n " +
1710+ " <rdf:Bag>\n " +
1711+ " <rdf:li rdf:parseType=\" Resource\" >\n " +
1712+ " <pdfaSchema:schema>PDF/UA Universal Accessibility Schema</pdfaSchema:schema>\n " +
1713+ " <pdfaSchema:namespaceURI>http://www.aiim.org/pdfua/ns/id/</pdfaSchema:namespaceURI>\n " +
1714+ " <pdfaSchema:prefix>pdfuaid</pdfaSchema:prefix>\n " +
1715+ " <pdfaSchema:property>\n " +
1716+ " <rdf:Seq>\n " +
1717+ " <rdf:li rdf:parseType=\" Resource\" >\n " +
1718+ " <pdfaProperty:name>part</pdfaProperty:name>\n " +
1719+ " <pdfaProperty:valueType>Integer</pdfaProperty:valueType>\n " +
1720+ " <pdfaProperty:category>internal</pdfaProperty:category>\n " +
1721+ " <pdfaProperty:description>Indicates, which part of ISO 14289 standard is followed</pdfaProperty:description>\n " +
1722+ " </rdf:li>\n " +
1723+ " </rdf:Seq>\n " +
1724+ " </pdfaSchema:property>\n " +
1725+ " </rdf:li>\n " +
1726+ " </rdf:Bag>\n " +
1727+ " </pdfaExtension:schemas>\n " +
1728+ " <pdfuaid:part>1</pdfuaid:part>\n " +
1729+ " </rdf:Description>\n " +
1730+ " </rdf:RDF>\n " +
1731+ "</x:xmpmeta><?xpacket end='w'?>" ;
1732+ final DomXmpParser xmpParser = new DomXmpParser ();
1733+ XMPMetadata xmp = xmpParser .parse (s .getBytes (StandardCharsets .UTF_8 ));
1734+ }
16911735}
0 commit comments