Added in API level 1

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.

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

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(systemId: String!)

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

Register the DTD event handler.

open Unit

Register the SAX1 document event handler.

open Unit

Set a document locator.

open Unit

Register the entity resolver.

open Unit

Register the error event handler.

open Unit
setLocale(locale: Locale!)

Set the locale for error reporting.

open Unit

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

Added in API level 1
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

Added in API level 1
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

Added in API level 1
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

Added in API level 1
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

Added in API level 1
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

Added in API level 1
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

Added in API level 1
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

Added in API level 1
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

Added in API level 1
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

Added in API level 1
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

Added in API level 1
open fun setDTDHandler(handler: DTDHandler!): Unit

Register the DTD event handler.

Parameters
handler DTDHandler!: The new DTD event handler.

setDocumentHandler

Added in API level 1
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

Added in API level 1
open fun setDocumentLocator(locator: Locator!): Unit

Set a document locator.

Parameters
locator Locator!: The document locator.

setEntityResolver

Added in API level 1
open fun setEntityResolver(resolver: EntityResolver!): Unit

Register the entity resolver.

Parameters
resolver EntityResolver!: The new resolver.

setErrorHandler

Added in API level 1
open fun setErrorHandler(handler: ErrorHandler!): Unit

Register the error event handler.

Parameters
handler ErrorHandler!: The new error event handler.

setLocale

Added in API level 1
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.
Exceptions
org.xml.sax.SAXException Thrown unless overridden.

skippedEntity

Added in API level 1
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

Added in API level 1
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

Added in API level 1
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

Added in API level 1
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