org.xml.sax.helpers
public class ParserAdapter extends Object implements XMLReader, DocumentHandler
This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY.
This class wraps a SAX1 Parser
and makes it act as a SAX2 XMLReader
,
with feature, property, and Namespace support. Note
that it is not possible to report skippedEntity
events, since SAX1 does not make that information available.
This adapter does not test for duplicate Namespace-qualified attribute names.
Since: SAX 2.0
Version: 2.0r2pre
See Also: XMLReaderAdapter XMLReader Parser
Constructor Summary | |
---|---|
ParserAdapter()
Construct a new parser adapter.
| |
ParserAdapter(Parser parser)
Construct a new parser adapter.
|
Method Summary | |
---|---|
void | characters(char[] ch, int start, int length)
Adapt a SAX1 characters event.
|
void | endDocument()
Adapt a SAX1 end document event.
|
void | endElement(String qName)
Adapt a SAX1 end element event.
|
ContentHandler | getContentHandler()
Return the current content handler.
|
DTDHandler | getDTDHandler()
Return the current DTD handler.
|
EntityResolver | getEntityResolver()
Return the current entity resolver.
|
ErrorHandler | getErrorHandler()
Return the current error handler.
|
boolean | getFeature(String name)
Check a parser feature.
|
Object | getProperty(String name)
Get a parser property.
|
void | ignorableWhitespace(char[] ch, int start, int length)
Adapt a SAX1 ignorable whitespace event.
|
void | parse(String systemId)
Parse an XML document.
|
void | parse(InputSource input)
Parse an XML document.
|
void | processingInstruction(String target, String data)
Adapt a SAX1 processing instruction event.
|
void | setContentHandler(ContentHandler handler)
Set the content handler.
|
void | setDocumentLocator(Locator locator)
Adapt a SAX1 document locator event.
|
void | setDTDHandler(DTDHandler handler)
Set the DTD handler.
|
void | setEntityResolver(EntityResolver resolver)
Set the entity resolver.
|
void | setErrorHandler(ErrorHandler handler)
Set the error handler.
|
void | setFeature(String name, boolean state)
Set a feature for the parser.
|
void | setProperty(String name, Object value)
Set a parser property.
|
void | startDocument()
Adapt a SAX1 start document event.
|
void | startElement(String qName, AttributeList qAtts)
Adapt a SAX1 startElement event.
|
Use the "org.xml.sax.parser" property to locate the embedded SAX1 driver.
Throws: org.xml.sax.SAXException If the embedded driver cannot be instantiated or if the org.xml.sax.parser property is not specified.
Note that the embedded parser cannot be changed once the adapter is created; to embed a different parser, allocate a new ParserAdapter.
Parameters: parser The SAX1 parser to embed.
Throws: java.lang.NullPointerException If the parser parameter is null.
Parameters: ch An array of characters. start The starting position in the array. length The number of characters to use.
Throws: org.xml.sax.SAXException The client may raise a processing exception.
See Also: DocumentHandler
Throws: org.xml.sax.SAXException The client may raise a processing exception.
See Also: DocumentHandler
Parameters: qName The qualified (prefixed) name.
Throws: org.xml.sax.SAXException The client may raise a processing exception.
See Also: DocumentHandler
Returns: The current content handler, or null if none was supplied.
See Also: XMLReader
Returns: The current DTD handler, or null if none was supplied.
See Also: XMLReader
Returns: The current entity resolver, or null if none was supplied.
See Also: XMLReader
Returns: The current error handler, or null if none was supplied.
See Also: XMLReader
The only features supported are namespaces and namespace-prefixes.
Parameters: name The feature name, as a complete URI.
Returns: The current feature state.
Throws: org.xml.sax.SAXNotRecognizedException If the feature name is not known. org.xml.sax.SAXNotSupportedException If querying the feature state is not supported.
See Also: XMLReader
No special properties are currently supported.
Parameters: name The property name.
Returns: The property value.
Throws: org.xml.sax.SAXNotRecognizedException If the feature name is not known. org.xml.sax.SAXNotSupportedException If the feature state is not supported.
See Also: XMLReader
Parameters: ch An array of characters. start The starting position in the array. length The number of characters to use.
Throws: org.xml.sax.SAXException The client may raise a processing exception.
See Also: DocumentHandler
Parameters: systemId The absolute URL of the document.
Throws: java.io.IOException If there is a problem reading the raw content of the document. org.xml.sax.SAXException If there is a problem processing the document.
Parameters: input An input source for the document.
Throws: java.io.IOException If there is a problem reading the raw content of the document. org.xml.sax.SAXException If there is a problem processing the document.
See Also: ParserAdapter parse
Parameters: target The processing instruction target. data The remainder of the processing instruction
Throws: org.xml.sax.SAXException The client may raise a processing exception.
See Also: DocumentHandler
Parameters: resolver The new content handler.
Throws: java.lang.NullPointerException If the content handler parameter is null.
See Also: XMLReader
Parameters: locator A document locator.
See Also: ContentHandler
Parameters: resolver The new DTD handler.
Throws: java.lang.NullPointerException If the DTD handler parameter is null.
See Also: XMLReader
Parameters: resolver The new entity resolver.
Throws: java.lang.NullPointerException If the entity resolver parameter is null.
See Also: XMLReader
Parameters: resolver The new error handler.
Throws: java.lang.NullPointerException If the error handler parameter is null.
See Also: XMLReader
The only features supported are namespaces and namespace-prefixes.
Parameters: name The feature name, as a complete URI. state The requested feature state.
Throws: org.xml.sax.SAXNotRecognizedException If the feature name is not known. org.xml.sax.SAXNotSupportedException If the feature state is not supported.
See Also: XMLReader
No special properties are currently supported.
Parameters: name The property name. value The property value.
Throws: org.xml.sax.SAXNotRecognizedException If the feature name is not known. org.xml.sax.SAXNotSupportedException If the feature state is not supported.
See Also: XMLReader
Throws: org.xml.sax.SAXException The client may raise a processing exception.
See Also: DocumentHandler
If necessary, perform Namespace processing.
Parameters: qName The qualified (prefixed) name. qAtts The XML 1.0 attribute list (with qnames).