Search in sources :

Example 1 with XMPIterator

use of com.adobe.xmp.XMPIterator in project tika by apache.

the class TikaToXMPTest method convert_wrongGenericMetadata_notConverted.

@Test
public void convert_wrongGenericMetadata_notConverted() throws XMPException, TikaException {
    // unknown prefix
    tikaMetadata.set("unknown:key", "unknownPrefixValue");
    // not qualified key
    tikaMetadata.set("wrongKey", "wrongKeyValue");
    XMPMeta xmp = TikaToXMP.convert(tikaMetadata, null);
    // XMP is empty
    XMPIterator iter = xmp.iterator();
    assertFalse(iter.hasNext());
}
Also used : XMPIterator(com.adobe.xmp.XMPIterator) XMPMeta(com.adobe.xmp.XMPMeta) Test(org.junit.Test)

Example 2 with XMPIterator

use of com.adobe.xmp.XMPIterator in project tika by apache.

the class XMPMetadata method size.

/**
     * Returns the number of top-level namespaces
     */
@Override
public int size() {
    int size = 0;
    try {
        // Get an iterator for the XMP packet, starting at the top level schema nodes
        XMPIterator nsIter = xmpData.iterator(new IteratorOptions().setJustChildren(true).setOmitQualifiers(true));
        // iterate all top level namespaces
        while (nsIter.hasNext()) {
            nsIter.next();
            size++;
        }
    } catch (XMPException e) {
    // ignore
    }
    return size;
}
Also used : XMPIterator(com.adobe.xmp.XMPIterator) XMPException(com.adobe.xmp.XMPException) IteratorOptions(com.adobe.xmp.options.IteratorOptions)

Aggregations

XMPIterator (com.adobe.xmp.XMPIterator)2 XMPException (com.adobe.xmp.XMPException)1 XMPMeta (com.adobe.xmp.XMPMeta)1 IteratorOptions (com.adobe.xmp.options.IteratorOptions)1 Test (org.junit.Test)1