1 17 18 19 20 package org.apache.fop.fo.extensions.xmp; 21 22 import org.apache.fop.util.ContentHandlerFactory; 23 import org.apache.xmlgraphics.xmp.XMPConstants; 24 import org.apache.xmlgraphics.xmp.XMPHandler; 25 import org.xml.sax.ContentHandler ; 26 import org.xml.sax.SAXException ; 27 28 31 public class XMPContentHandlerFactory implements ContentHandlerFactory { 32 33 private static final String [] NAMESPACES = new String [] 34 {XMPConstants.XMP_NAMESPACE, XMPConstants.RDF_NAMESPACE}; 35 36 37 public String [] getSupportedNamespaces() { 38 return NAMESPACES; 39 } 40 41 42 public ContentHandler createContentHandler() throws SAXException { 43 return new FOPXMPHandler(); 44 } 45 46 49 private class FOPXMPHandler extends XMPHandler implements ObjectSource { 50 51 private ObjectBuiltListener obListener; 52 53 public Object getObject() { 54 return getMetadata(); 55 } 56 57 58 public void setObjectBuiltListener(ObjectBuiltListener listener) { 59 this.obListener = listener; 60 } 61 62 63 public void endDocument() throws SAXException { 64 if (obListener != null) { 65 obListener.notifyObjectBuilt(getObject()); 66 } 67 } 68 69 } 70 71 } 72 | Popular Tags |