Added in API level 1

ParserAdapter

open class ParserAdapter : XMLReader, DocumentHandler
kotlin.Any
   ↳ org.xml.sax.helpers.ParserAdapter

Adapt a SAX1 Parser as a SAX2 XMLReader. 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 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.

Summary

Public constructors

Construct a new parser adapter.

Construct a new parser adapter.

Public methods
open Unit
characters(ch: CharArray!, start: Int, length: Int)

Adapter implementation method; do not call.

open Unit

Adapter implementation method; do not call.

open Unit
endElement(qName: String!)

Adapter implementation method; do not call.

open ContentHandler!

Return the current content handler.

open DTDHandler!

Return the current DTD handler.

open EntityResolver!

Return the current entity resolver.

open ErrorHandler!

Return the current error handler.

open Boolean

Check a parser feature flag.

open Any!

Get a parser property.

open Unit
ignorableWhitespace(ch: CharArray!, start: Int, length: Int)

Adapter implementation method; do not call.

open Unit
parse(systemId: String!)

Parse an XML document.

open Unit
parse(input: InputSource!)

Parse an XML document.

open Unit
processingInstruction(target: String!, data: String!)

Adapter implementation method; do not call.

open Unit

Set the content handler.

open Unit

Set the DTD handler.

open Unit

Adapter implementation method; do not call.

open Unit

Set the entity resolver.

open Unit

Set the error handler.

open Unit
setFeature(name: String!, value: Boolean)

Set a feature flag for the parser.

open Unit
setProperty(name: String!, value: Any!)

Set a parser property.

open Unit

Adapter implementation method; do not call.

open Unit
startElement(qName: String!, qAtts: AttributeList!)

Adapter implementation method; do not call.

Public constructors

ParserAdapter

Added in API level 1
ParserAdapter()

Construct a new parser adapter.

Use the "org.xml.sax.parser" property to locate the embedded SAX1 driver.

Exceptions
org.xml.sax.SAXException If the embedded driver cannot be instantiated or if the org.xml.sax.parser property is not specified.

ParserAdapter

Added in API level 1
ParserAdapter(parser: Parser!)

Construct a new parser adapter.

Note that the embedded parser cannot be changed once the adapter is created; to embed a different parser, allocate a new ParserAdapter.

Parameters
parser Parser!: The SAX1 parser to embed.
Exceptions
java.lang.NullPointerException If the parser parameter is null.

Public methods

characters

Added in API level 1
open fun characters(
    ch: CharArray!,
    start: Int,
    length: Int
): Unit

Adapter implementation method; do not call. Adapt a SAX1 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 The client may raise a processing exception.

endDocument

Added in API level 1
open fun endDocument(): Unit

Adapter implementation method; do not call. Adapt a SAX1 end document event.

Exceptions
org.xml.sax.SAXException The client may raise a processing exception.

endElement

Added in API level 1
open fun endElement(qName: String!): Unit

Adapter implementation method; do not call. Adapt a SAX1 end element event.

Parameters
name The element type name
qName String!: The qualified (prefixed) name.
Exceptions
org.xml.sax.SAXException The client may raise a processing exception.

getContentHandler

Added in API level 1
open fun getContentHandler(): ContentHandler!

Return the current content handler.

Return
ContentHandler! The current content handler, or null if none was supplied.

getDTDHandler

Added in API level 1
open fun getDTDHandler(): DTDHandler!

Return the current DTD handler.

Return
DTDHandler! the current DTD handler, or null if none was supplied

getEntityResolver

Added in API level 1
open fun getEntityResolver(): EntityResolver!

Return the current entity resolver.

Return
EntityResolver! The current entity resolver, or null if none was supplied.

getErrorHandler

Added in API level 1
open fun getErrorHandler(): ErrorHandler!

Return the current error handler.

Return
ErrorHandler! The current error handler, or null if none was supplied.

getFeature

Added in API level 1
open fun getFeature(name: String!): Boolean

Check a parser feature flag.

The only features recognized are namespaces and namespace-prefixes.

Parameters
name String!: The feature name, as a complete URI.
Return
Boolean The current feature value.
Exceptions
org.xml.sax.SAXNotRecognizedException If the feature value can't be assigned or retrieved.
org.xml.sax.SAXNotSupportedException If the feature is not currently readable.

getProperty

Added in API level 1
open fun getProperty(name: String!): Any!

Get a parser property.

No properties are currently recognized.

Parameters
name String!: The property name.
Return
Any! The property value.
Exceptions
org.xml.sax.SAXNotRecognizedException If the property value can't be assigned or retrieved.
org.xml.sax.SAXNotSupportedException If the property value is not currently readable.

ignorableWhitespace

Added in API level 1
open fun ignorableWhitespace(
    ch: CharArray!,
    start: Int,
    length: Int
): Unit

Adapter implementation method; do not call. Adapt a SAX1 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 The client may raise a processing exception.

parse

Added in API level 1
open fun parse(systemId: String!): Unit

Parse an XML document.

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 an XML document.

Parameters
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

Adapter implementation method; do not call. Adapt a SAX1 processing instruction event.

Parameters
target String!: The processing instruction target.
data String!: The remainder of the processing instruction
Exceptions
org.xml.sax.SAXException The client may raise a processing exception.

setContentHandler

Added in API level 1
open fun setContentHandler(handler: ContentHandler!): Unit

Set the content handler.

Parameters
handler ContentHandler!: the new content handler

setDTDHandler

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

Set the DTD handler.

Parameters
handler DTDHandler!: the new DTD handler

setDocumentLocator

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

Adapter implementation method; do not call. Adapt a SAX1 document locator event.

Parameters
locator Locator!: A document locator.

setEntityResolver

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

Set the entity resolver.

Parameters
resolver EntityResolver!: The new entity resolver.

setErrorHandler

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

Set the error handler.

Parameters
handler ErrorHandler!: The new error handler.

setFeature

Added in API level 1
open fun setFeature(
    name: String!,
    value: Boolean
): Unit

Set a feature flag for the parser.

The only features recognized are namespaces and namespace-prefixes.

Parameters
name String!: The feature name, as a complete URI.
value Boolean: The requested feature value.
Exceptions
org.xml.sax.SAXNotRecognizedException If the feature can't be assigned or retrieved.
org.xml.sax.SAXNotSupportedException If the feature can't be assigned that value.

setProperty

Added in API level 1
open fun setProperty(
    name: String!,
    value: Any!
): Unit

Set a parser property.

No properties are currently recognized.

Parameters
name String!: The property name.
value Any!: The property value.
Exceptions
org.xml.sax.SAXNotRecognizedException If the property value can't be assigned or retrieved.
org.xml.sax.SAXNotSupportedException If the property can't be assigned that value.

startDocument

Added in API level 1
open fun startDocument(): Unit

Adapter implementation method; do not call. Adapt a SAX1 start document event.

Exceptions
org.xml.sax.SAXException The client may raise a processing exception.

startElement

Added in API level 1
open fun startElement(
    qName: String!,
    qAtts: AttributeList!
): Unit

Adapter implementation method; do not call. Adapt a SAX1 startElement event.

If necessary, perform Namespace processing.

Parameters
name The element type name.
atts The attributes attached to the element, if any.
qName String!: The qualified (prefixed) name.
qAtts AttributeList!: The XML attribute list (with qnames).
Exceptions
org.xml.sax.SAXException The client may raise a processing exception.