Class ResolvingXMLFilter
- All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, XMLFilter, XMLReader
- Direct Known Subclasses:
ResolvingXMLReader
XMLFilter that performs catalog resolution.
This class implements the oasis-xml-catalog processing instruction if the underlying
resolver allows it.
Each instance constructed with the zero-argument constructor uses a shared, static resolver. This avoids paying the instantiation cost each time a parse is created.
- Author:
- ndw
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ResolverLoggerprotected Resolverprotected static Resolver -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a filter with the default resolver.ResolvingXMLFilter(XMLReader parent, Resolver resolver) Construct an XML filter with the specified parent and resolver.ResolvingXMLFilter(Resolver resolver) Construct an XML filter with the specified resolver. -
Method Summary
Modifier and TypeMethodDescriptionProvide access to the underlying Catalog.voidnotationDecl(String name, String publicId, String systemId) SAX DTDHandler API.voidSAX XMLReader API.voidparse(InputSource input) Parse a document.voidprocessingInstruction(String target, String pidata) SAX ContentHandler API.resolveEntity(String publicId, String systemId) Implements theresolveEntitymethod for the SAX interface, using an underlying CatalogResolver to do the real work.resolveEntity(String name, String publicId, String baseURI, String systemId) Implements theEntityResolver2interface.voidstartElement(String uri, String localName, String qName, Attributes atts) SAX ContentHandler API.voidunparsedEntityDecl(String name, String publicId, String systemId, String notationName) SAX DTDHandler API.Methods inherited from class XMLFilterImpl
characters, endDocument, endElement, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startDocument, startPrefixMapping, warningMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ContentHandler
declaration
-
Field Details
-
logger
-
staticResolver
-
resolver
-
-
Constructor Details
-
ResolvingXMLFilter
public ResolvingXMLFilter()Construct a filter with the default resolver. -
ResolvingXMLFilter
Construct an XML filter with the specified resolver.- Parameters:
resolver- The resolver
-
ResolvingXMLFilter
-
-
Method Details
-
getResolver
Provide access to the underlying Catalog.- Returns:
- The underlying resolver
-
parse
Parse a document.If the input doesn't have an associated open stream, this class will attempt to find the URI of the input in the catalog.
- Specified by:
parsein interfaceXMLReader- Overrides:
parsein classXMLFilterImpl- Throws:
IOExceptionSAXException
-
parse
SAX XMLReader API.- Specified by:
parsein interfaceXMLReader- Overrides:
parsein classXMLFilterImpl- Throws:
IOExceptionSAXException- See Also:
-
resolveEntity
Implements theresolveEntitymethod for the SAX interface, using an underlying CatalogResolver to do the real work.- Specified by:
resolveEntityin interfaceEntityResolver- Overrides:
resolveEntityin classXMLFilterImpl- Throws:
SAXExceptionIOException
-
resolveEntity
public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException Implements theEntityResolver2interface.- Parameters:
name- The entity namepublicId- The entity public identifierbaseURI- The base URIsystemId- The entity system identifier- Returns:
- The resolved entity
- Throws:
SAXException- If a SAX error occursIOException- If an I/O error occurs
-
notationDecl
SAX DTDHandler API.Captured here only to detect the end of the prolog so that we can ignore subsequent oasis-xml-catalog PIs. Otherwise the events are just passed through.
- Specified by:
notationDeclin interfaceDTDHandler- Overrides:
notationDeclin classXMLFilterImpl- Throws:
SAXException
-
unparsedEntityDecl
public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException SAX DTDHandler API.Captured here only to detect the end of the prolog so that we can ignore subsequent oasis-xml-catalog PIs. Otherwise the events are just passed through.
- Specified by:
unparsedEntityDeclin interfaceDTDHandler- Overrides:
unparsedEntityDeclin classXMLFilterImpl- Throws:
SAXException
-
startElement
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException SAX ContentHandler API.Captured here only to detect the end of the prolog so that we can ignore subsequent oasis-xml-catalog PIs. Otherwise the events are just passed through.
- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classXMLFilterImpl- Throws:
SAXException
-
processingInstruction
SAX ContentHandler API.Detect and use the oasis-xml-catalog PI if it occurs.
- Specified by:
processingInstructionin interfaceContentHandler- Overrides:
processingInstructionin classXMLFilterImpl- Throws:
SAXException
-