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());
}
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;
}
Aggregations