Class ResolvingXMLFilter
- java.lang.Object
-
- org.xml.sax.helpers.XMLFilterImpl
-
- org.apache.xml.resolver.tools.ResolvingXMLFilter
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler,org.xml.sax.DTDHandler,org.xml.sax.EntityResolver,org.xml.sax.ErrorHandler,org.xml.sax.XMLFilter,org.xml.sax.XMLReader
- Direct Known Subclasses:
ResolvingXMLReader
public class ResolvingXMLFilter extends org.xml.sax.helpers.XMLFilterImplA SAX XMLFilter that performs catalog-based entity resolution.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:
CatalogResolver,XMLFilter
-
-
Field Summary
Fields Modifier and Type Field Description static booleansuppressExplanationSuppress explanatory message?
-
Constructor Summary
Constructors Constructor Description ResolvingXMLFilter()Construct an empty XML Filter with no parent.ResolvingXMLFilter(CatalogManager manager)Construct an XML filter with the specified parent.ResolvingXMLFilter(org.xml.sax.XMLReader parent)Construct an XML filter with the specified parent.ResolvingXMLFilter(org.xml.sax.XMLReader parent, CatalogManager manager)Construct an XML filter with the specified parent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CataloggetCatalog()Provide accessto the underlying Catalog.voidnotationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)SAX DTDHandler API.voidparse(java.lang.String systemId)SAX XMLReader API.voidparse(org.xml.sax.InputSource input)SAX XMLReader API.voidprocessingInstruction(java.lang.String target, java.lang.String pidata)SAX ContentHandler API.org.xml.sax.InputSourceresolveEntity(java.lang.String publicId, java.lang.String systemId)Implements theresolveEntitymethod for the SAX interface, using an underlying CatalogResolver to do the real work.voidstartElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)SAX ContentHandler API.voidunparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.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
-
-
-
-
Field Detail
-
suppressExplanation
public static boolean suppressExplanation
Suppress explanatory message?- See Also:
parse(InputSource)
-
-
Constructor Detail
-
ResolvingXMLFilter
public ResolvingXMLFilter()
Construct an empty XML Filter with no parent.
-
ResolvingXMLFilter
public ResolvingXMLFilter(org.xml.sax.XMLReader parent)
Construct an XML filter with the specified parent.
-
ResolvingXMLFilter
public ResolvingXMLFilter(CatalogManager manager)
Construct an XML filter with the specified parent.
-
ResolvingXMLFilter
public ResolvingXMLFilter(org.xml.sax.XMLReader parent, CatalogManager manager)Construct an XML filter with the specified parent.
-
-
Method Detail
-
getCatalog
public Catalog getCatalog()
Provide accessto the underlying Catalog.
-
parse
public void parse(org.xml.sax.InputSource input) throws java.io.IOException, org.xml.sax.SAXExceptionSAX 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
suppressExplanationis set tofalsebefore parsing, it will never be printed.- Specified by:
parsein interfaceorg.xml.sax.XMLReader- Overrides:
parsein classorg.xml.sax.helpers.XMLFilterImpl- Throws:
java.io.IOExceptionorg.xml.sax.SAXException
-
parse
public void parse(java.lang.String systemId) throws java.io.IOException, org.xml.sax.SAXExceptionSAX XMLReader API.- Specified by:
parsein interfaceorg.xml.sax.XMLReader- Overrides:
parsein classorg.xml.sax.helpers.XMLFilterImpl- Throws:
java.io.IOExceptionorg.xml.sax.SAXException- See Also:
parse(InputSource)
-
resolveEntity
public org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)Implements theresolveEntitymethod for the SAX interface, using an underlying CatalogResolver to do the real work.- Specified by:
resolveEntityin interfaceorg.xml.sax.EntityResolver- Overrides:
resolveEntityin classorg.xml.sax.helpers.XMLFilterImpl
-
notationDecl
public void notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXExceptionSAX 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 interfaceorg.xml.sax.DTDHandler- Overrides:
notationDeclin classorg.xml.sax.helpers.XMLFilterImpl- Throws:
org.xml.sax.SAXException
-
unparsedEntityDecl
public void unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName) throws org.xml.sax.SAXExceptionSAX 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 interfaceorg.xml.sax.DTDHandler- Overrides:
unparsedEntityDeclin classorg.xml.sax.helpers.XMLFilterImpl- Throws:
org.xml.sax.SAXException
-
startElement
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXExceptionSAX 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 interfaceorg.xml.sax.ContentHandler- Overrides:
startElementin classorg.xml.sax.helpers.XMLFilterImpl- Throws:
org.xml.sax.SAXException
-
processingInstruction
public void processingInstruction(java.lang.String target, java.lang.String pidata) throws org.xml.sax.SAXExceptionSAX ContentHandler API.Detect and use the oasis-xml-catalog PI if it occurs.
- Specified by:
processingInstructionin interfaceorg.xml.sax.ContentHandler- Overrides:
processingInstructionin classorg.xml.sax.helpers.XMLFilterImpl- Throws:
org.xml.sax.SAXException
-
-