Package com.adobe.epubcheck.xml.handlers
Class XMLHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.xml.sax.ext.DefaultHandler2
-
- com.adobe.epubcheck.xml.handlers.LocationHandler
-
- com.adobe.epubcheck.xml.handlers.BaseURLHandler
-
- com.adobe.epubcheck.xml.handlers.XMLHandler
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler,org.xml.sax.DTDHandler,org.xml.sax.EntityResolver,org.xml.sax.ErrorHandler,org.xml.sax.ext.DeclHandler,org.xml.sax.ext.EntityResolver2,org.xml.sax.ext.LexicalHandler
- Direct Known Subclasses:
DTBookHandler,NCXHandler,OCFContainerFileHandler,OCFEncryptionFileHandler,OPFHandler,OPSHandler,OverlayHandler,SearchKeyMapHandler
public abstract class XMLHandler extends BaseURLHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected ValidationContextcontextprivate XMLElementcurrentElementprivate org.xml.sax.ext.Locator2locatorprotected java.lang.Stringpathprotected Reportreport
-
Constructor Summary
Constructors Constructor Description XMLHandler(ValidationContext context)XMLHandler(ValidationContext context, io.mola.galimatias.URL baseURL)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcheckXMLVersion()protected XMLElementcurrentElement()Return the currently parsed element, ornullif the parser is not yet parsing an element.protected voidendElement()voidendElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)protected voidregisterReference(io.mola.galimatias.URL url, Reference.Type type)Convenience method to register a reference to theReferenceRegistry.protected voidregisterReference(io.mola.galimatias.URL url, Reference.Type type, boolean hasIntrinsicFallback)Convenience method to register a reference to theReferenceRegistry.voidsetDocumentLocator(org.xml.sax.Locator locator)protected voidstartElement()voidstartElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attribs)-
Methods inherited from class com.adobe.epubcheck.xml.handlers.BaseURLHandler
baseURL, checkURL
-
Methods inherited from class com.adobe.epubcheck.xml.handlers.LocationHandler
location, location
-
Methods inherited from class org.xml.sax.ext.DefaultHandler2
attributeDecl, comment, elementDecl, endCDATA, endDTD, endEntity, externalEntityDecl, getExternalSubset, internalEntityDecl, resolveEntity, resolveEntity, startCDATA, startDTD, startEntity
-
-
-
-
Field Detail
-
currentElement
private XMLElement currentElement
-
locator
private org.xml.sax.ext.Locator2 locator
-
context
protected final ValidationContext context
-
report
protected final Report report
-
path
protected final java.lang.String path
-
-
Constructor Detail
-
XMLHandler
public XMLHandler(ValidationContext context)
-
XMLHandler
public XMLHandler(ValidationContext context, io.mola.galimatias.URL baseURL)
-
-
Method Detail
-
setDocumentLocator
public final void setDocumentLocator(org.xml.sax.Locator locator)
- Specified by:
setDocumentLocatorin interfaceorg.xml.sax.ContentHandler- Overrides:
setDocumentLocatorin classLocationHandler
-
startElement
public final void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attribs)- Specified by:
startElementin interfaceorg.xml.sax.ContentHandler- Overrides:
startElementin classBaseURLHandler
-
startElement
protected void startElement()
-
endElement
public final void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)- Specified by:
endElementin interfaceorg.xml.sax.ContentHandler- Overrides:
endElementin classorg.xml.sax.helpers.DefaultHandler
-
endElement
protected void endElement()
-
currentElement
protected final XMLElement currentElement()
Return the currently parsed element, ornullif the parser is not yet parsing an element.- Returns:
- the currently parsed element, or
null.
-
checkXMLVersion
private void checkXMLVersion()
-
registerReference
protected final void registerReference(io.mola.galimatias.URL url, Reference.Type type)Convenience method to register a reference to theReferenceRegistry.Does nothing if the context has no registry (single-file validaiton) or if the URL is
null; else callsReferenceRegistry.registerReference(URL, Reference.Type, EPUBLocation)- Parameters:
url- the URL of to registertype- the type of the reference
-
registerReference
protected final void registerReference(io.mola.galimatias.URL url, Reference.Type type, boolean hasIntrinsicFallback)Convenience method to register a reference to theReferenceRegistry.Does nothing if the context has no registry (single-file validaiton) or if the URL is
null; else callsReferenceRegistry.registerReference(URL, Reference.Type, EPUBLocation, boolean)- Parameters:
url- the URL of to registertype- the type of the referencehasIntrinsicFallback- if the reference has an intrinsic fallback
-
-