ParserAdapter
open class ParserAdapter : DocumentHandler, XMLReader
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. |
|
ParserAdapter(parser: Parser!) 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 |
getFeature(name: String!) Check a parser feature flag. |
open Any! |
getProperty(name: String!) Get a parser property. |
open Unit |
ignorableWhitespace(ch: CharArray!, start: Int, length: Int) Adapter implementation method; do not call. |
open Unit |
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 |
setContentHandler(handler: ContentHandler!) Set the content handler. |
open Unit |
setDTDHandler(handler: DTDHandler!) Set the DTD handler. |
open Unit |
setDocumentLocator(locator: Locator!) Adapter implementation method; do not call. |
open Unit |
setEntityResolver(resolver: EntityResolver!) Set the entity resolver. |
open Unit |
setErrorHandler(handler: ErrorHandler!) 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
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
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
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
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
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
open fun getContentHandler(): ContentHandler!
Return the current content handler.
Return | |
---|---|
ContentHandler! |
The current content handler, or null if none was supplied. |
getDTDHandler
open fun getDTDHandler(): DTDHandler!
Return the current DTD handler.
Return | |
---|---|
DTDHandler! |
the current DTD handler, or null if none was supplied |
getEntityResolver
open fun getEntityResolver(): EntityResolver!
Return the current entity resolver.
Return | |
---|---|
EntityResolver! |
The current entity resolver, or null if none was supplied. |
getErrorHandler
open fun getErrorHandler(): ErrorHandler!
Return the current error handler.
Return | |
---|---|
ErrorHandler! |
The current error handler, or null if none was supplied. |
getFeature
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. |
See Also
getProperty
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. |
See Also
ignorableWhitespace
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
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
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
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
open fun setContentHandler(handler: ContentHandler!): Unit
Set the content handler.
Parameters | |
---|---|
handler |
ContentHandler!: the new content handler |
setDTDHandler
open fun setDTDHandler(handler: DTDHandler!): Unit
Set the DTD handler.
Parameters | |
---|---|
handler |
DTDHandler!: the new DTD handler |
setDocumentLocator
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
open fun setEntityResolver(resolver: EntityResolver!): Unit
Set the entity resolver.
Parameters | |
---|---|
resolver |
EntityResolver!: The new entity resolver. |
setErrorHandler
open fun setErrorHandler(handler: ErrorHandler!): Unit
Set the error handler.
Parameters | |
---|---|
handler |
ErrorHandler!: The new error handler. |
setFeature
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. |
See Also
setProperty
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. |
See Also
startDocument
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
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. |