org.xml.sax.helpers
public class XMLReaderAdapter extends Object implements Parser, ContentHandler
This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY. See http://www.saxproject.org for further information.
This class wraps a SAX2 {@link org.xml.sax.XMLReader XMLReader} and makes it act as a SAX1 {@link org.xml.sax.Parser Parser}. The XMLReader must support a true value for the http://xml.org/sax/features/namespace-prefixes property or parsing will fail with a {@link org.xml.sax.SAXException SAXException}; if the XMLReader supports a false value for the http://xml.org/sax/features/namespaces property, that will also be used to improve efficiency.
Since: SAX 2.0
Version: 2.0.1 (sax2r2)
Constructor Summary | |
---|---|
XMLReaderAdapter()
Create a new adapter.
| |
XMLReaderAdapter(XMLReader xmlReader)
Create a new adapter.
|
Method Summary | |
---|---|
void | characters(char[] ch, int start, int length)
Adapt a SAX2 characters event.
|
void | endDocument()
End document event.
|
void | endElement(String uri, String localName, String qName)
Adapt a SAX2 end element event.
|
void | endPrefixMapping(String prefix)
Adapt a SAX2 end prefix mapping event.
|
void | ignorableWhitespace(char[] ch, int start, int length)
Adapt a SAX2 ignorable whitespace event.
|
void | parse(String systemId)
Parse the document.
|
void | parse(InputSource input)
Parse the document.
|
void | processingInstruction(String target, String data)
Adapt a SAX2 processing instruction event.
|
void | setDocumentHandler(DocumentHandler handler)
Register the SAX1 document event handler.
|
void | setDocumentLocator(Locator locator)
Set a document locator.
|
void | setDTDHandler(DTDHandler handler)
Register the DTD event handler.
|
void | setEntityResolver(EntityResolver resolver)
Register the entity resolver.
|
void | setErrorHandler(ErrorHandler handler)
Register the error event handler.
|
void | setLocale(Locale locale)
Set the locale for error reporting.
|
void | skippedEntity(String name)
Adapt a SAX2 skipped entity event.
|
void | startDocument()
Start document event.
|
void | startElement(String uri, String localName, String qName, Attributes atts)
Adapt a SAX2 start element event.
|
void | startPrefixMapping(String prefix, String uri)
Adapt a SAX2 start prefix mapping event.
|
Use the "org.xml.sax.driver" property to locate the SAX2 driver to embed.
Throws: org.xml.sax.SAXException If the embedded driver cannot be instantiated or if the org.xml.sax.driver property is not specified.
Create a new adapter, wrapped around a SAX2 XMLReader. The adapter will make the XMLReader act like a SAX1 Parser.
Parameters: xmlReader The SAX2 XMLReader to wrap.
Throws: java.lang.NullPointerException If the argument 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: ContentHandler
Throws: org.xml.sax.SAXException The client may raise a processing exception.
See Also: ContentHandler
Parameters: uri The Namespace URI. localName The Namespace local name. qName The qualified (prefixed) name.
Throws: org.xml.sax.SAXException The client may raise a processing exception.
See Also: ContentHandler
Parameters: prefix The prefix being mapped.
See Also: ContentHandler
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: ContentHandler
This method will throw an exception if the embedded XMLReader does not support the http://xml.org/sax/features/namespace-prefixes property.
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.
This method will throw an exception if the embedded XMLReader does not support the http://xml.org/sax/features/namespace-prefixes property.
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: XMLReaderAdapter 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: ContentHandler
Note that the SAX1 document handler has no Namespace support.
Parameters: handler The new SAX1 document event handler.
See Also: Parser
Parameters: locator The document locator.
See Also: ContentHandler
Parameters: handler The new DTD event handler.
See Also: Parser
Parameters: resolver The new resolver.
See Also: Parser
Parameters: handler The new error event handler.
See Also: Parser
This is not supported in SAX2, and will always throw an exception.
Parameters: The locale for error reporting.
Throws: org.xml.sax.SAXException Thrown unless overridden.
See Also: Parser
Parameters: name The name of the skipped entity.
Throws: org.xml.sax.SAXException Throwable by subclasses.
See Also: ContentHandler
Throws: org.xml.sax.SAXException The client may raise a processing exception.
See Also: ContentHandler
Parameters: uri The Namespace URI. localName The Namespace local name. qName The qualified (prefixed) name. atts The SAX2 attributes.
Throws: org.xml.sax.SAXException The client may raise a processing exception.
See Also: ContentHandler
Parameters: prefix The prefix being mapped. uri The Namespace URI being mapped to.
See Also: ContentHandler