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
public class XMPHandler extends DefaultHandler
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 Constructor Description XMPHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidendElement(String namespaceURI, String localName, String rawName)Catches the end of an element.voidfatalError(SAXParseException exception)Catch a fatal error.booleanisPdfaCompliant()Returns 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, warning
-
-
-
-
Method Detail
-
isPdfaCompliant
public boolean isPdfaCompliant()
Returns true if no violations of PDF/A compliance have been found, false if a problem was detected.
-
processingInstruction
public void processingInstruction(String target, String data) throws SAXException
- Specified by:
processingInstructionin interfaceContentHandler- Overrides:
processingInstructionin classDefaultHandler- Throws:
SAXException
-
endElement
public void endElement(String namespaceURI, String localName, String rawName)
Catches the end of an element.- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler
-
fatalError
public void fatalError(SAXParseException exception)
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
-
-