Search in sources :

Example 36 with TextType

use of org.apache.xmpbox.type.TextType in project pdfbox by apache.

the class AbstractXMPSchemaTest method testGetSetTextProperty.

protected void testGetSetTextProperty() throws Exception {
    String setName = setMethod(property);
    String getName = getMethod(property);
    TextType tt = metadata.getTypeMapping().createText(null, schema.getPrefix(), property, (String) value);
    Method setMethod = schemaClass.getMethod(setName, TextType.class);
    Method getMethod = schemaClass.getMethod(getName);
    setMethod.invoke(schema, tt);
    String found = ((TextType) getMethod.invoke(schema)).getStringValue();
    Assert.assertEquals(value, found);
}
Also used : Method(java.lang.reflect.Method) TextType(org.apache.xmpbox.type.TextType)

Example 37 with TextType

use of org.apache.xmpbox.type.TextType in project pdfbox by apache.

the class TestExifXmp method testNonStrict.

@Test
public void testNonStrict() throws Exception {
    InputStream is = this.getClass().getResourceAsStream("/validxmp/exif.xmp");
    DomXmpParser builder = new DomXmpParser();
    builder.setStrictParsing(false);
    XMPMetadata rxmp = builder.parse(is);
    ExifSchema schema = (ExifSchema) rxmp.getSchema(ExifSchema.class);
    TextType ss = (TextType) schema.getProperty(ExifSchema.SPECTRAL_SENSITIVITY);
    Assert.assertNotNull(ss);
    Assert.assertEquals("spectral sens value", ss.getValue());
}
Also used : XMPMetadata(org.apache.xmpbox.XMPMetadata) InputStream(java.io.InputStream) DomXmpParser(org.apache.xmpbox.xml.DomXmpParser) TextType(org.apache.xmpbox.type.TextType) Test(org.junit.Test)

Aggregations

TextType (org.apache.xmpbox.type.TextType)37 AbstractField (org.apache.xmpbox.type.AbstractField)5 ArrayProperty (org.apache.xmpbox.type.ArrayProperty)5 Test (org.junit.Test)4 Method (java.lang.reflect.Method)3 Attribute (org.apache.xmpbox.type.Attribute)3 XMPMetadata (org.apache.xmpbox.XMPMetadata)2 InputStream (java.io.InputStream)1 Calendar (java.util.Calendar)1 ValidationError (org.apache.pdfbox.preflight.ValidationResult.ValidationError)1 DublinCoreSchema (org.apache.xmpbox.schema.DublinCoreSchema)1 BadFieldValueException (org.apache.xmpbox.type.BadFieldValueException)1 BooleanType (org.apache.xmpbox.type.BooleanType)1 DateType (org.apache.xmpbox.type.DateType)1 IntegerType (org.apache.xmpbox.type.IntegerType)1 TypeMapping (org.apache.xmpbox.type.TypeMapping)1 URIType (org.apache.xmpbox.type.URIType)1 URLType (org.apache.xmpbox.type.URLType)1 DomXmpParser (org.apache.xmpbox.xml.DomXmpParser)1