use of org.apache.xmpbox.xml.DomXmpParser in project pdfbox by apache.
the class DeserializationTest method testGetTitle.
@Test
public void testGetTitle() throws Exception {
InputStream fis = DomXmpParser.class.getResourceAsStream("/validxmp/emptyli.xml");
DomXmpParser xdb = new DomXmpParser();
XMPMetadata meta = xdb.parse(fis);
DublinCoreSchema dc = meta.getDublinCoreSchema();
String s = dc.getTitle(null);
Assert.assertEquals("title value", s);
}
use of org.apache.xmpbox.xml.DomXmpParser in project pdfbox by apache.
the class DeserializationTest method testAltBagSeq.
@Test
public void testAltBagSeq() throws Exception {
InputStream fis = DomXmpParser.class.getResourceAsStream("/org/apache/xmpbox/parser/AltBagSeqTest.xml");
DomXmpParser xdb = new DomXmpParser();
xdb.parse(fis);
// XMPMetadata metadata=xdb.parse(fis);
// SaveMetadataHelper.serialize(metadata, true, System.out);
}
use of org.apache.xmpbox.xml.DomXmpParser in project pdfbox by apache.
the class DeserializationTest method testUndefinedSchema.
@Test
public void testUndefinedSchema() throws Exception {
InputStream fis = DomXmpParser.class.getResourceAsStream("/invalidxmp/undefinedschema.xml");
DomXmpParser xdb = new DomXmpParser();
try {
xdb.parse(fis);
Assert.fail("Should fail during parse");
} catch (XmpParsingException e) {
Assert.assertEquals(ErrorType.NoSchema, e.getErrorType());
}
}
use of org.apache.xmpbox.xml.DomXmpParser in project pdfbox by apache.
the class DeserializationTest method testUndefinedStructuredWithDefinedSchema.
@Test
public void testUndefinedStructuredWithDefinedSchema() throws Exception {
InputStream fis = DomXmpParser.class.getResourceAsStream("/invalidxmp/undefinedstructuredindefinedschema.xml");
DomXmpParser xdb = new DomXmpParser();
try {
xdb.parse(fis);
Assert.fail("Should fail during parse");
} catch (XmpParsingException e) {
Assert.assertEquals(ErrorType.NoValueType, e.getErrorType());
}
}
use of org.apache.xmpbox.xml.DomXmpParser in project pdfbox by apache.
the class DeserializationTest method testWithNoXPacketEnd.
@Test
public void testWithNoXPacketEnd() throws Exception {
InputStream fis = DomXmpParser.class.getResourceAsStream("/invalidxmp/noxpacketend.xml");
DomXmpParser xdb = new DomXmpParser();
try {
xdb.parse(fis);
Assert.fail("Should fail during parse");
} catch (XmpParsingException e) {
Assert.assertEquals(ErrorType.XpacketBadEnd, e.getErrorType());
}
}
Aggregations