Package edu.harvard.hul.ois.jhove
Class XMPHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
edu.harvard.hul.ois.jhove.XMPHandler
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler
This class encapsulates XMP metadata within a file. It makes use
of an InputStream as a data source.
This differs from normal XML handling in that it's necessary to
process the xpacket processing instruction in order to determine
the encoding of the XML. the processingInstruction function looks
for xpacket, and throws a special SAXException if it's necessary
to change encoding.
We don't actually extract any information from the XMP, but
simply check it for well-formedness. By convention, XMPHandler
should be invoked on an XMPSource (TBW), which provides the
ability to recapture the InputStream from which the XMP was
obtained and put it into a property once it's verified here.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidendElement(String namespaceURI, String localName, String rawName) Catches the end of an element.voidfatalError(SAXParseException exception) Catch a fatal error.booleanReturns true if no violations of PDF/A compliance have been found, false if a problem was detected.voidprocessingInstruction(String target, String data) Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endPrefixMapping, error, ignorableWhitespace, notationDecl, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration
-
Constructor Details
-
XMPHandler
public XMPHandler()
-
-
Method Details
-
isPdfaCompliant
public boolean isPdfaCompliant()Returns true if no violations of PDF/A compliance have been found, false if a problem was detected. -
processingInstruction
- Specified by:
processingInstructionin interfaceContentHandler- Overrides:
processingInstructionin classDefaultHandler- Throws:
SAXException
-
endElement
Catches the end of an element.- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler
-
fatalError
Catch a fatal error. This is put here because the default behavior is to report a "fatal error" to standard output, which is harmless but scary.- Specified by:
fatalErrorin interfaceErrorHandler- Overrides:
fatalErrorin classDefaultHandler
-