Author: gbailleul
Date: Sun Oct 28 08:46:29 2012
New Revision: 1402956
URL: http://svn.apache.org/viewvc?rev=1402956&view=rev
Log:
PDFBOX-1388:
fixed rdf:about deserialization problem
Modified:
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/Attribute.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/xml/DomXmpParser.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/parser/DeserializationTest.java
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/resources/validxmp/emptyli.xml
Modified:
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/Attribute.java
URL:
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/Attribute.java?rev=1402956&r1=1402955&r2=1402956&view=diff
==============================================================================
---
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/Attribute.java
(original)
+++
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/Attribute.java
Sun Oct 28 08:46:29 2012
@@ -110,4 +110,10 @@ public class Attribute {
this.value = value;
}
+ public String toString () {
+ StringBuilder sb = new StringBuilder(80);
+
sb.append("[attr:{").append(nsURI).append("}").append(name).append("=").append(value).append("]");
+ return sb.toString();
+ }
+
}
Modified:
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/xml/DomXmpParser.java
URL:
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/xml/DomXmpParser.java?rev=1402956&r1=1402955&r2=1402956&view=diff
==============================================================================
---
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/xml/DomXmpParser.java
(original)
+++
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/xml/DomXmpParser.java
Sun Oct 28 08:46:29 2012
@@ -162,6 +162,7 @@ public class DomXmpParser {
XMPSchema schema = xmp.getSchema(namespace);
if (schema==null) {
schema =
tm.getSchemaFactory(namespace).createXMPSchema(xmp, property.getPrefix());
+ loadAttributes(schema, description);
}
ComplexPropertyContainer container =
schema.getContainer();
// create property
@@ -314,7 +315,7 @@ public class DomXmpParser {
}
}
- private void loadAttributes (AbstractSimpleProperty sp, Element
element) {
+ private void loadAttributes (AbstractField sp, Element element) {
NamedNodeMap nnm = element.getAttributes();
for (int i=0; i < nnm.getLength() ; i++) {
Attr attr = (Attr)nnm.item(i);
Modified:
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/parser/DeserializationTest.java
URL:
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/parser/DeserializationTest.java?rev=1402956&r1=1402955&r2=1402956&view=diff
==============================================================================
---
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/parser/DeserializationTest.java
(original)
+++
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/parser/DeserializationTest.java
Sun Oct 28 08:46:29 2012
@@ -28,6 +28,8 @@ import java.util.List;
import org.apache.padaf.xmpbox.DateConverter;
import org.apache.padaf.xmpbox.XMPMetadata;
import org.apache.padaf.xmpbox.schema.DublinCoreSchema;
+import org.apache.padaf.xmpbox.schema.XMPSchema;
+import org.apache.padaf.xmpbox.type.Attribute;
import org.apache.padaf.xmpbox.type.ThumbnailType;
import org.apache.padaf.xmpbox.xml.DomXmpParser;
import org.apache.padaf.xmpbox.xml.XmpParsingException;
@@ -283,4 +285,17 @@ public class DeserializationTest {
}
}
+ @Test
+ public void testRdfAboutFound() throws Exception {
+ InputStream fis = DomXmpParser.class
+ .getResourceAsStream("/validxmp/emptyli.xml");
+ DomXmpParser xdb = new DomXmpParser();
+ XMPMetadata meta = xdb.parse(fis);
+ List<XMPSchema> schemas = meta.getAllSchemas();
+ for (XMPSchema xmpSchema : schemas) {
+ Assert.assertNotNull(xmpSchema.getAboutAttribute());
+ }
+ }
+
+
}
Modified:
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/resources/validxmp/emptyli.xml
URL:
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/resources/validxmp/emptyli.xml?rev=1402956&r1=1402955&r2=1402956&view=diff
==============================================================================
---
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/resources/validxmp/emptyli.xml
(original)
+++
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/resources/validxmp/emptyli.xml
Sun Oct 28 08:46:29 2012
@@ -15,13 +15,6 @@
<rdf:Description rdf:about=""
xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:format>application/pdf</dc:format>
- <!--
- <dc:description>
- <rdf:Alt>
- <rdf:li xml:lang="x-default"/>
- </rdf:Alt>
- </dc:description>
--->
<dc:title>
<rdf:Alt>
<rdf:li xml:lang="x-default">title value</rdf:li>
@@ -33,118 +26,7 @@
</rdf:Seq>
</dc:creator>
</rdf:Description>
- <!--
- <rdf:Description rdf:about=""
- xmlns:xmp="http://ns.adobe.com/xap/1.0/">
- <xmp:CreateDate>2009-04-26T16:56:29-06:00</xmp:CreateDate>
- <xmp:CreatorTool>LaTeX with hyperref package</xmp:CreatorTool>
- <xmp:ModifyDate>2012-07-26T07:23:35-04:00</xmp:ModifyDate>
- <xmp:MetadataDate>2012-07-26T07:23:35-04:00</xmp:MetadataDate>
- </rdf:Description>
- <rdf:Description rdf:about=""
- xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
- <pdf:Keywords/>
- <pdf:Producer>pdfTeX-1.40.3</pdf:Producer>
- <pdf:Trapped>False</pdf:Trapped>
- </rdf:Description>
- <rdf:Description rdf:about=""
- xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
- xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#">
-
<xmpMM:DocumentID>uuid:bbc5e922-8a33-4f23-803a-96bc4f7d99fb</xmpMM:DocumentID>
-
<xmpMM:InstanceID>uuid:cd6bd7b5-aaa8-4bb7-a216-6a8900317f2c</xmpMM:InstanceID>
- <xmpMM:RenditionClass>default</xmpMM:RenditionClass>
- <xmpMM:VersionID>1</xmpMM:VersionID>
- <xmpMM:History>
- <rdf:Seq>
- <rdf:li rdf:parseType="Resource">
- <stEvt:action>converted</stEvt:action>
-
<stEvt:instanceID>uuid:a607d073-c0de-4d36-8377-d209b5a98592</stEvt:instanceID>
- <stEvt:parameters>converted to PDF/A-1b</stEvt:parameters>
- <stEvt:softwareAgent>Preflight</stEvt:softwareAgent>
- <stEvt:when>2012-07-26T07:23:35-04:00</stEvt:when>
- </rdf:li>
- </rdf:Seq>
- </xmpMM:History>
- </rdf:Description>
- <rdf:Description rdf:about=""
- xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/">
- <pdfaid:part>1</pdfaid:part>
- <pdfaid:conformance>B</pdfaid:conformance>
- </rdf:Description>
- <rdf:Description rdf:about=""
- xmlns:pdfaExtension="http://www.aiim.org/pdfa/ns/extension/"
- xmlns:pdfaSchema="http://www.aiim.org/pdfa/ns/schema#"
- xmlns:pdfaProperty="http://www.aiim.org/pdfa/ns/property#">
- <pdfaExtension:schemas>
- <rdf:Bag>
- <rdf:li rdf:parseType="Resource">
-
<pdfaSchema:namespaceURI>http://ns.adobe.com/pdf/1.3/</pdfaSchema:namespaceURI>
- <pdfaSchema:prefix>pdf</pdfaSchema:prefix>
- <pdfaSchema:schema>Adobe PDF Schema</pdfaSchema:schema>
- <pdfaSchema:property>
- <rdf:Seq>
- <rdf:li rdf:parseType="Resource">
-
<pdfaProperty:category>internal</pdfaProperty:category>
- <pdfaProperty:description>A name object indicating
whether the document has been modified to include trapping
information</pdfaProperty:description>
- <pdfaProperty:name>Trapped</pdfaProperty:name>
-
<pdfaProperty:valueType>Text</pdfaProperty:valueType>
- </rdf:li>
- </rdf:Seq>
- </pdfaSchema:property>
- </rdf:li>
- <rdf:li rdf:parseType="Resource">
-
<pdfaSchema:namespaceURI>http://ns.adobe.com/xap/1.0/mm/</pdfaSchema:namespaceURI>
- <pdfaSchema:prefix>xmpMM</pdfaSchema:prefix>
- <pdfaSchema:schema>XMP Media Management
Schema</pdfaSchema:schema>
- <pdfaSchema:property>
- <rdf:Seq>
- <rdf:li rdf:parseType="Resource">
-
<pdfaProperty:category>internal</pdfaProperty:category>
- <pdfaProperty:description>UUID based identifier for
specific incarnation of a document</pdfaProperty:description>
- <pdfaProperty:name>InstanceID</pdfaProperty:name>
- <pdfaProperty:valueType>URI</pdfaProperty:valueType>
- </rdf:li>
- <rdf:li rdf:parseType="Resource">
-
<pdfaProperty:category>internal</pdfaProperty:category>
- <pdfaProperty:description>The common identifier for
all versions and renditions of a document.</pdfaProperty:description>
-
<pdfaProperty:name>OriginalDocumentID</pdfaProperty:name>
- <pdfaProperty:valueType>URI</pdfaProperty:valueType>
- </rdf:li>
- </rdf:Seq>
- </pdfaSchema:property>
- </rdf:li>
- <rdf:li rdf:parseType="Resource">
-
<pdfaSchema:namespaceURI>http://www.aiim.org/pdfa/ns/id/</pdfaSchema:namespaceURI>
- <pdfaSchema:prefix>pdfaid</pdfaSchema:prefix>
- <pdfaSchema:schema>PDF/A ID Schema</pdfaSchema:schema>
- <pdfaSchema:property>
- <rdf:Seq>
- <rdf:li rdf:parseType="Resource">
-
<pdfaProperty:category>internal</pdfaProperty:category>
- <pdfaProperty:description>Part of PDF/A
standard</pdfaProperty:description>
- <pdfaProperty:name>part</pdfaProperty:name>
-
<pdfaProperty:valueType>Integer</pdfaProperty:valueType>
- </rdf:li>
- <rdf:li rdf:parseType="Resource">
-
<pdfaProperty:category>internal</pdfaProperty:category>
- <pdfaProperty:description>Amendment of PDF/A
standard</pdfaProperty:description>
- <pdfaProperty:name>amd</pdfaProperty:name>
-
<pdfaProperty:valueType>Text</pdfaProperty:valueType>
- </rdf:li>
- <rdf:li rdf:parseType="Resource">
-
<pdfaProperty:category>internal</pdfaProperty:category>
- <pdfaProperty:description>Conformance level of
PDF/A standard</pdfaProperty:description>
- <pdfaProperty:name>conformance</pdfaProperty:name>
-
<pdfaProperty:valueType>Text</pdfaProperty:valueType>
- </rdf:li>
- </rdf:Seq>
- </pdfaSchema:property>
- </rdf:li>
- </rdf:Bag>
- </pdfaExtension:schemas>
- </rdf:Description>
- -->
- </rdf:RDF>
+ </rdf:RDF>
</x:xmpmeta>
<?xpacket end='r'?>