Class ResolvingXMLFilter
- java.lang.Object
-
- org.xml.sax.helpers.XMLFilterImpl
-
- com.sun.org.apache.xml.internal.resolver.tools.ResolvingXMLFilter
-
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler,XMLFilter,XMLReader
- Direct Known Subclasses:
ResolvingXMLReader
public class ResolvingXMLFilter extends XMLFilterImpl
A 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(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CataloggetCatalog()Provide accessto the underlying Catalog.voidnotationDecl(String name, String publicId, String systemId)SAX DTDHandler API.voidparse(String systemId)SAX XMLReader API.voidparse(InputSource input)SAX XMLReader API.voidprocessingInstruction(String target, String pidata)SAX ContentHandler API.InputSourceresolveEntity(String publicId, String systemId)Implements theresolveEntitymethod for the SAX interface, using an underlying CatalogResolver to do the real work.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 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(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(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(InputSource input) throws IOException, SAXException
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
suppressExplanationis set tofalsebefore parsing, it will never be printed.- Specified by:
parsein interfaceXMLReader- Overrides:
parsein classXMLFilterImpl- Throws:
IOExceptionSAXException
-
parse
public void parse(String systemId) throws IOException, SAXException
SAX XMLReader API.- Specified by:
parsein interfaceXMLReader- Overrides:
parsein classXMLFilterImpl- Throws:
IOExceptionSAXException- See Also:
parse(InputSource)
-
resolveEntity
public InputSource resolveEntity(String publicId, String systemId)
Implements theresolveEntitymethod for the SAX interface, using an underlying CatalogResolver to do the real work.- Specified by:
resolveEntityin interfaceEntityResolver- Overrides:
resolveEntityin classXMLFilterImpl
-
notationDecl
public void notationDecl(String name, String publicId, String systemId) 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:
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
public void processingInstruction(String target, String pidata) throws SAXException
SAX ContentHandler API.Detect and use the oasis-xml-catalog PI if it occurs.
- Specified by:
processingInstructionin interfaceContentHandler- Overrides:
processingInstructionin classXMLFilterImpl- Throws:
SAXException
-
-