XMLReaderAdapter
open class XMLReaderAdapter : ContentHandler, Parser
kotlin.Any | |
↳ | org.xml.sax.helpers.XMLReaderAdapter |
Adapt a SAX2 XMLReader as a SAX1 Parser. 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 XMLReader
and makes it act as a SAX1 Parser
. The XMLReader must support a true value for the http://xml.org/sax/features/namespace-prefixes property or parsing will fail with a 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.
Summary
Public constructors | |
---|---|
Create a new adapter. |
|
XMLReaderAdapter(xmlReader: XMLReader!) Create a new adapter. |
Public methods | |
---|---|
open Unit |
characters(ch: CharArray!, start: Int, length: Int) Adapt a SAX2 characters event. |
open Unit |
End document event. |
open Unit |
endElement(uri: String!, localName: String!, qName: String!) Adapt a SAX2 end element event. |
open Unit |
endPrefixMapping(prefix: String!) Adapt a SAX2 end prefix mapping event. |
open Unit |
ignorableWhitespace(ch: CharArray!, start: Int, length: Int) Adapt a SAX2 ignorable whitespace event. |
open Unit |
Parse the document. |
open Unit |
parse(input: InputSource!) Parse the document. |
open Unit |
processingInstruction(target: String!, data: String!) Adapt a SAX2 processing instruction event. |
open Unit |
setDTDHandler(handler: DTDHandler!) Register the DTD event handler. |
open Unit |
setDocumentHandler(handler: DocumentHandler!) Register the SAX1 document event handler. |
open Unit |
setDocumentLocator(locator: Locator!) Set a document locator. |
open Unit |
setEntityResolver(resolver: EntityResolver!) Register the entity resolver. |
open Unit |
setErrorHandler(handler: ErrorHandler!) Register the error event handler. |
open Unit |
Set the locale for error reporting. |
open Unit |
skippedEntity(name: String!) Adapt a SAX2 skipped entity event. |
open Unit |
Start document event. |
open Unit |
startElement(uri: String!, localName: String!, qName: String!, atts: Attributes!) Adapt a SAX2 start element event. |
open Unit |
startPrefixMapping(prefix: String!, uri: String!) Adapt a SAX2 start prefix mapping event. |
Public constructors
XMLReaderAdapter
XMLReaderAdapter()
Create a new adapter.
Use the "org.xml.sax.driver" property to locate the SAX2 driver to embed.
Exceptions | |
---|---|
org.xml.sax.SAXException |
If the embedded driver cannot be instantiated or if the org.xml.sax.driver property is not specified. |
XMLReaderAdapter
XMLReaderAdapter(xmlReader: XMLReader!)
Create a new adapter.
Create a new adapter, wrapped around a SAX2 XMLReader. The adapter will make the XMLReader act like a SAX1 Parser.
Parameters | |
---|---|
xmlReader |
XMLReader!: The SAX2 XMLReader to wrap. |
Exceptions | |
---|---|
java.lang.NullPointerException |
If the argument is null. |
Public methods
characters
open fun characters(
ch: CharArray!,
start: Int,
length: Int
): Unit
Adapt a SAX2 characters event.
Parameters | |
---|---|
ch |
CharArray!: An array of characters. |
start |
Int: The starting position in the array. |
length |
Int: The number of characters to use. |
Exceptions | |
---|---|
org.xml.sax.SAXException |
any SAX exception, possibly wrapping another exception |
org.xml.sax.SAXException |
The client may raise a processing exception. |
endDocument
open fun endDocument(): Unit
End document event.
Exceptions | |
---|---|
org.xml.sax.SAXException |
any SAX exception, possibly wrapping another exception |
org.xml.sax.SAXException |
The client may raise a processing exception. |
endElement
open fun endElement(
uri: String!,
localName: String!,
qName: String!
): Unit
Adapt a SAX2 end element event.
Parameters | |
---|---|
uri |
String!: The Namespace URI. |
localName |
String!: The Namespace local name. |
qName |
String!: The qualified (prefixed) name. |
Exceptions | |
---|---|
org.xml.sax.SAXException |
any SAX exception, possibly wrapping another exception |
org.xml.sax.SAXException |
The client may raise a processing exception. |
endPrefixMapping
open fun endPrefixMapping(prefix: String!): Unit
Adapt a SAX2 end prefix mapping event.
Parameters | |
---|---|
prefix |
String!: The prefix being mapped. |
Exceptions | |
---|---|
org.xml.sax.SAXException |
the client may throw an exception during processing |
ignorableWhitespace
open fun ignorableWhitespace(
ch: CharArray!,
start: Int,
length: Int
): Unit
Adapt a SAX2 ignorable whitespace event.
Parameters | |
---|---|
ch |
CharArray!: An array of characters. |
start |
Int: The starting position in the array. |
length |
Int: The number of characters to use. |
Exceptions | |
---|---|
org.xml.sax.SAXException |
any SAX exception, possibly wrapping another exception |
org.xml.sax.SAXException |
The client may raise a processing exception. |
parse
open fun parse(systemId: String!): Unit
Parse 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 | |
---|---|
systemId |
String!: The absolute URL of the document. |
Exceptions | |
---|---|
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. |
parse
open fun parse(input: InputSource!): Unit
Parse 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 | |
---|---|
source |
The input source for the top-level of the XML document. |
input |
InputSource!: An input source for the document. |
Exceptions | |
---|---|
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. |
processingInstruction
open fun processingInstruction(
target: String!,
data: String!
): Unit
Adapt a SAX2 processing instruction event.
Parameters | |
---|---|
target |
String!: The processing instruction target. |
data |
String!: The remainder of the processing instruction |
Exceptions | |
---|---|
org.xml.sax.SAXException |
any SAX exception, possibly wrapping another exception |
org.xml.sax.SAXException |
The client may raise a processing exception. |
setDTDHandler
open fun setDTDHandler(handler: DTDHandler!): Unit
Register the DTD event handler.
Parameters | |
---|---|
handler |
DTDHandler!: The new DTD event handler. |
See Also
setDocumentHandler
open fun setDocumentHandler(handler: DocumentHandler!): Unit
Register the SAX1 document event handler.
Note that the SAX1 document handler has no Namespace support.
Parameters | |
---|---|
handler |
DocumentHandler!: The new SAX1 document event handler. |
setDocumentLocator
open fun setDocumentLocator(locator: Locator!): Unit
Set a document locator.
Parameters | |
---|---|
locator |
Locator!: The document locator. |
setEntityResolver
open fun setEntityResolver(resolver: EntityResolver!): Unit
Register the entity resolver.
Parameters | |
---|---|
resolver |
EntityResolver!: The new resolver. |
See Also
setErrorHandler
open fun setErrorHandler(handler: ErrorHandler!): Unit
Register the error event handler.
Parameters | |
---|---|
handler |
ErrorHandler!: The new error event handler. |
See Also
setLocale
open fun setLocale(locale: Locale!): Unit
Set the locale for error reporting.
This is not supported in SAX2, and will always throw an exception.
Parameters | |
---|---|
locale |
Locale!: the locale for error reporting. |
See Also
Exceptions | |
---|---|
org.xml.sax.SAXException |
Thrown unless overridden. |
skippedEntity
open fun skippedEntity(name: String!): Unit
Adapt a SAX2 skipped entity event.
Parameters | |
---|---|
name |
String!: The name of the skipped entity. |
Exceptions | |
---|---|
org.xml.sax.SAXException |
any SAX exception, possibly wrapping another exception |
org.xml.sax.SAXException |
Throwable by subclasses. |
startDocument
open fun startDocument(): Unit
Start document event.
Exceptions | |
---|---|
org.xml.sax.SAXException |
any SAX exception, possibly wrapping another exception |
org.xml.sax.SAXException |
The client may raise a processing exception. |
startElement
open fun startElement(
uri: String!,
localName: String!,
qName: String!,
atts: Attributes!
): Unit
Adapt a SAX2 start element event.
Parameters | |
---|---|
uri |
String!: The Namespace URI. |
localName |
String!: The Namespace local name. |
qName |
String!: The qualified (prefixed) name. |
atts |
Attributes!: The SAX2 attributes. |
Exceptions | |
---|---|
org.xml.sax.SAXException |
any SAX exception, possibly wrapping another exception |
org.xml.sax.SAXException |
The client may raise a processing exception. |
startPrefixMapping
open fun startPrefixMapping(
prefix: String!,
uri: String!
): Unit
Adapt a SAX2 start prefix mapping event.
Parameters | |
---|---|
prefix |
String!: The prefix being mapped. |
uri |
String!: The Namespace URI being mapped to. |
Exceptions | |
---|---|
org.xml.sax.SAXException |
the client may throw an exception during processing |