Class ResolvingXMLFilter
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
,XMLFilter
,XMLReader
- Direct Known Subclasses:
ResolvingXMLReader
This class implements a SAX XMLFilter that performs entity resolution using the CatalogResolver. The actual, underlying parser is obtained from a SAXParserFactory.
- Version:
- 1.0
- Author:
- Norman Walsh Norman.Walsh@Sun.COM
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic boolean
Suppress explanatory message? -
Constructor Summary
ConstructorsConstructorDescriptionConstruct an empty XML Filter with no parent.ResolvingXMLFilter
(CatalogManager manager) Construct an XML filter with the specified parent.ResolvingXMLFilter
(XMLReader parent) Construct an XML filter with the specified parent.ResolvingXMLFilter
(XMLReader parent, CatalogManager manager) Construct an XML filter with the specified parent. -
Method Summary
Modifier and TypeMethodDescriptionProvide accessto the underlying Catalog.void
notationDecl
(String name, String publicId, String systemId) SAX DTDHandler API.void
SAX XMLReader API.void
parse
(InputSource input) SAX XMLReader API.void
processingInstruction
(String target, String pidata) SAX ContentHandler API.resolveEntity
(String publicId, String systemId) Implements theresolveEntity
method for the SAX interface, using an underlying CatalogResolver to do the real work.void
startElement
(String uri, String localName, String qName, Attributes atts) SAX ContentHandler API.void
unparsedEntityDecl
(String name, String publicId, String systemId, String notationName) SAX DTDHandler API.Methods inherited from class org.xml.sax.helpers.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, warning
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
suppressExplanation
public static boolean suppressExplanationSuppress explanatory message?- See Also:
-
-
Constructor Details
-
ResolvingXMLFilter
public ResolvingXMLFilter()Construct an empty XML Filter with no parent. -
ResolvingXMLFilter
Construct an XML filter with the specified parent. -
ResolvingXMLFilter
Construct an XML filter with the specified parent. -
ResolvingXMLFilter
Construct an XML filter with the specified parent.
-
-
Method Details
-
getCatalog
Provide accessto the underlying Catalog. -
parse
SAX XMLReader API.Note that the JAXP 1.1ea2 parser crashes with an InternalError if it encounters a system identifier that appears to be a relative URI that begins with a slash. For example, the declaration:
<!DOCTYPE book SYSTEM "/path/to/dtd/on/my/system/docbookx.dtd">
would cause such an error. As a convenience, this method catches that error and prints an explanation. (Unfortunately, it's not possible to identify the particular system identifier that causes the problem.)
The underlying error is forwarded after printing the explanatory message. The message is only every printed once and if
suppressExplanation
is set tofalse
before parsing, it will never be printed.- Specified by:
parse
in interfaceXMLReader
- Overrides:
parse
in classXMLFilterImpl
- Throws:
IOException
SAXException
-
parse
SAX XMLReader API.- Specified by:
parse
in interfaceXMLReader
- Overrides:
parse
in classXMLFilterImpl
- Throws:
IOException
SAXException
- See Also:
-
resolveEntity
Implements theresolveEntity
method for the SAX interface, using an underlying CatalogResolver to do the real work.- Specified by:
resolveEntity
in interfaceEntityResolver
- Overrides:
resolveEntity
in classXMLFilterImpl
-
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:
notationDecl
in interfaceDTDHandler
- Overrides:
notationDecl
in 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:
unparsedEntityDecl
in interfaceDTDHandler
- Overrides:
unparsedEntityDecl
in 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:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classXMLFilterImpl
- Throws:
SAXException
-
processingInstruction
SAX ContentHandler API.Detect and use the oasis-xml-catalog PI if it occurs.
- Specified by:
processingInstruction
in interfaceContentHandler
- Overrides:
processingInstruction
in classXMLFilterImpl
- Throws:
SAXException
-