public class ResolvingParser
implements Parser, DTDHandler, DocumentHandler, EntityResolver
A SAX Parser that performs catalog-based entity resolution.
This class implements a SAX Parser that performs entity resolution
using the CatalogResolver. The actual, underlying parser is obtained
from a SAXParserFactory.
characters
public void characters(char[] ch,
int start,
int length)
throws SAXException
SAX DocumentHandler API
endDocument
public void endDocument()
throws SAXException
SAX DocumentHandler API
endElement
public void endElement(String name)
throws SAXException
SAX DocumentHandler API
getCatalog
public Catalog getCatalog()
Return the Catalog being used
ignorableWhitespace
public void ignorableWhitespace(char[] ch,
int start,
int length)
throws SAXException
SAX DocumentHandler API
notationDecl
public void notationDecl(String name,
String publicId,
String systemId)
throws SAXException
SAX DTDHandler API
parse
public void parse(InputSource input)
throws IOException,
SAXException
SAX Parser 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 to
false
before
parsing, it will never be printed.
parse
public void parse(String systemId)
throws IOException,
SAXException
SAX Parser API
processingInstruction
public void processingInstruction(String target,
String pidata)
throws SAXException
SAX DocumentHandler API
resolveEntity
public InputSource resolveEntity(String publicId,
String systemId)
Implements the resolveEntity
method
for the SAX interface, using an underlying CatalogResolver
to do the real work.
setDTDHandler
public void setDTDHandler(DTDHandler handler)
SAX Parser API
setDocumentHandler
public void setDocumentHandler(DocumentHandler handler)
SAX Parser API
setDocumentLocator
public void setDocumentLocator(Locator locator)
SAX DocumentHandler API
setEntityResolver
public void setEntityResolver(EntityResolver resolver)
SAX Parser API
The purpose of this class is to implement an entity resolver.
Attempting to set a different one is pointless (and ignored).
setErrorHandler
public void setErrorHandler(ErrorHandler handler)
SAX Parser API
setLocale
public void setLocale(Locale locale)
throws SAXException
SAX Parser API
startDocument
public void startDocument()
throws SAXException
SAX DocumentHandler API
startElement
public void startElement(String name,
AttributeList atts)
throws SAXException
SAX DocumentHandler API
unparsedEntityDecl
public void unparsedEntityDecl(String name,
String publicId,
String systemId,
String notationName)
throws SAXException
SAX DTDHandler API