Added in API level 1

DefaultHandler2

open class DefaultHandler2 : DefaultHandler, LexicalHandler, DeclHandler, EntityResolver2
kotlin.Any
   ↳ org.xml.sax.helpers.DefaultHandler
   ↳ org.xml.sax.ext.DefaultHandler2

This class extends the SAX2 base handler class to support the SAX2 LexicalHandler, DeclHandler, and EntityResolver2 extensions. Except for overriding the original SAX1 resolveEntity() method the added handler methods just return. Subclassers may override everything on a method-by-method basis. This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY.

Note: this class might yet learn that the ContentHandler.setDocumentLocator() call might be passed a Locator2 object, and that the ContentHandler.startElement() call might be passed a Attributes2 object.

Summary

Public constructors

Constructs a handler which ignores all parsing events.

Public methods
open Unit
attributeDecl(eName: String!, aName: String!, type: String!, mode: String!, value: String!)

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

open Unit
elementDecl(name: String!, model: String!)

open Unit

open Unit

open Unit
endEntity(name: String!)

open Unit
externalEntityDecl(name: String!, publicId: String!, systemId: String!)

open InputSource!
getExternalSubset(name: String!, baseURI: String!)

Tells the parser that if no external subset has been declared in the document text, none should be used.

open Unit
internalEntityDecl(name: String!, value: String!)

open InputSource!
resolveEntity(name: String!, publicId: String!, baseURI: String!, systemId: String!)

Tells the parser to resolve the systemId against the baseURI and read the entity text from that resulting absolute URI.

open InputSource!
resolveEntity(publicId: String!, systemId: String!)

Invokes org.

open Unit

open Unit
startDTD(name: String!, publicId: String!, systemId: String!)

open Unit

Inherited functions

Public constructors

DefaultHandler2

Added in API level 1
DefaultHandler2()

Constructs a handler which ignores all parsing events.

Public methods

attributeDecl

Added in API level 1
open fun attributeDecl(
    eName: String!,
    aName: String!,
    type: String!,
    mode: String!,
    value: String!
): Unit
Parameters
eName String!: The name of the associated element.
aName String!: The name of the attribute.
type String!: A string representing the attribute type.
mode String!: A string representing the attribute defaulting mode ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if none of these applies.
value String!: A string representing the attribute's default value, or null if there is none.

comment

Added in API level 1
open fun comment(
    ch: CharArray!,
    start: Int,
    length: Int
): Unit
Parameters
ch CharArray!: An array holding the characters in the comment.
start Int: The starting position in the array.
length Int: The number of characters to use from the array.

elementDecl

Added in API level 1
open fun elementDecl(
    name: String!,
    model: String!
): Unit
Parameters
name String!: The element type name.
model String!: The content model as a normalized string.

endCDATA

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

endDTD

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

endEntity

Added in API level 1
open fun endEntity(name: String!): Unit
Parameters
name String!: The name of the entity that is ending.

externalEntityDecl

Added in API level 1
open fun externalEntityDecl(
    name: String!,
    publicId: String!,
    systemId: String!
): Unit
Parameters
name String!: The name of the entity. If it is a parameter entity, the name will begin with '%'.
publicId String!: The entity's public identifier, or null if none was given.
systemId String!: The entity's system identifier.

getExternalSubset

Added in API level 1
open fun getExternalSubset(
    name: String!,
    baseURI: String!
): InputSource!

Tells the parser that if no external subset has been declared in the document text, none should be used.

Parameters
name String!: Identifies the document root element. This name comes from a DOCTYPE declaration (where available) or from the actual root element. The parameter is ignored.
baseURI String!: The document's base URI, serving as an additional hint for selecting the external subset. This is always an absolute URI, unless it is null because the XMLReader was given an InputSource without one. The parameter is ignored.
Return
InputSource! null (always).
Exceptions
org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
java.io.IOException Probably indicating a failure to create a new InputStream or Reader, or an illegal URL.

internalEntityDecl

Added in API level 1
open fun internalEntityDecl(
    name: String!,
    value: String!
): Unit
Parameters
name String!: The name of the entity. If it is a parameter entity, the name will begin with '%'.
value String!: The replacement text of the entity.

resolveEntity

Added in API level 1
open fun resolveEntity(
    name: String!,
    publicId: String!,
    baseURI: String!,
    systemId: String!
): InputSource!

Tells the parser to resolve the systemId against the baseURI and read the entity text from that resulting absolute URI. Note that because the older DefaultHandler.resolveEntity(), method is overridden to call this one, this method may sometimes be invoked with null name and baseURI, and with the systemId already absolutized.

Parameters
name String!: Identifies the external entity being resolved. Either "[dtd]" for the external subset, or a name starting with "%" to indicate a parameter entity, or else the name of a general entity. This is never null when invoked by a SAX2 parser.
publicId String!: The public identifier of the external entity being referenced (normalized as required by the XML specification), or null if none was supplied.
baseURI String!: The URI with respect to which relative systemIDs are interpreted. This is always an absolute URI, unless it is null (likely because the XMLReader was given an InputSource without one). This URI is defined by the XML specification to be the one associated with the "<" starting the relevant declaration.
systemId String!: The system identifier of the external entity being referenced; either a relative or absolute URI. This is never null when invoked by a SAX2 parser; only declared entities, and any external subset, are resolved by such parsers.
Return
InputSource! An InputSource object describing the new input source.
Exceptions
org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
java.io.IOException Probably indicating a failure to create a new InputStream or Reader, or an illegal URL.

resolveEntity

Added in API level 1
open fun resolveEntity(
    publicId: String!,
    systemId: String!
): InputSource!

Invokes org.xml.sax.ext.EntityResolver2#resolveEntity with null entity name and base URI. You only need to override that method to use this class.

Parameters
publicId String!: The public identifier of the external entity being referenced (normalized as required by the XML specification), or null if none was supplied.
systemId String!: The system identifier of the external entity being referenced; either a relative or absolute URI. This is never null when invoked by a SAX2 parser; only declared entities, and any external subset, are resolved by such parsers.
Return
InputSource! An InputSource object describing the new input source.
Exceptions
org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
java.io.IOException Probably indicating a failure to create a new InputStream or Reader, or an illegal URL.

startCDATA

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

startDTD

Added in API level 1
open fun startDTD(
    name: String!,
    publicId: String!,
    systemId: String!
): Unit
Parameters
name String!: The document type name.
publicId String!: The declared public identifier for the external DTD subset, or null if none was declared.
systemId String!: The declared system identifier for the external DTD subset, or null if none was declared. (Note that this is not resolved against the document base URI.)

startEntity

Added in API level 1
open fun startEntity(name: String!): Unit
Parameters
name String!: The name of the entity. If it is a parameter entity, the name will begin with '%', and if it is the external DTD subset, it will be "[dtd]".