Interface for reading an XML document using callbacks.

XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse.

All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.

Note: The original documentation comes from SAX 2.0.

Introduced properties

abstract fun content_handler: nullable ContentHandler

sax :: XMLReader :: content_handler

Return the current content handler.
abstract fun content_handler=(handler: nullable ContentHandler)

sax :: XMLReader :: content_handler=

Allow an application to register a content event handler.
abstract fun dtd_handler: nullable DTDHandler

sax :: XMLReader :: dtd_handler

Return the current DTD handler.
abstract fun dtd_handler=(handler: nullable DTDHandler)

sax :: XMLReader :: dtd_handler=

Allow an application to register a DTD event handler.
abstract fun entity_resolver: nullable EntityResolver

sax :: XMLReader :: entity_resolver

Return the current entity resolver.
abstract fun entity_resolver=(resolver: nullable EntityResolver)

sax :: XMLReader :: entity_resolver=

Allow an application to register an entity resolver.
abstract fun error_handler: nullable ErrorHandler

sax :: XMLReader :: error_handler

Return the current error handler.
abstract fun error_handler=(handler: nullable ErrorHandler)

sax :: XMLReader :: error_handler=

Allow an application to register an error event handler.
abstract fun feature(name: String): Bool

sax :: XMLReader :: feature

Look up the value of a feature flag.
abstract fun feature=(name: String, value: Bool)

sax :: XMLReader :: feature=

Set the value of a feature flag.
abstract fun feature_readable(name: String): Bool

sax :: XMLReader :: feature_readable

Is the retrieval of the specified feature flag supported given the current context?
abstract fun feature_recognized(name: String): Bool

sax :: XMLReader :: feature_recognized

Is the specified feature flag recognized by this parser?
abstract fun feature_writable(name: String): Bool

sax :: XMLReader :: feature_writable

Is the modification of the specified feature flag supported given the current context?
abstract fun parse(input: InputSource)

sax :: XMLReader :: parse

Parse an XML document.
abstract fun parse_file(system_id: String)

sax :: XMLReader :: parse_file

Parse an XML document from a system identifier (URI).
abstract fun property(name: String): nullable Object

sax :: XMLReader :: property

Look up the value of a property.
abstract fun property=(name: String, value: nullable Object)

sax :: XMLReader :: property=

Set the value of a property.
abstract fun property_readable(name: String): Bool

sax :: XMLReader :: property_readable

Is the retrieval of the specified property supported given the current context?
abstract fun property_recognized(name: String): Bool

sax :: XMLReader :: property_recognized

Is the specified property recognized by this parser?
abstract fun property_writable(name: String): Bool

sax :: XMLReader :: property_writable

Is the modification of the specified property supported given the current context?

Redefined properties

redef type SELF: XMLReader

sax $ XMLReader :: SELF

Type of this instance, automatically specialized in every class

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
abstract fun content_handler: nullable ContentHandler

sax :: XMLReader :: content_handler

Return the current content handler.
abstract fun content_handler=(handler: nullable ContentHandler)

sax :: XMLReader :: content_handler=

Allow an application to register a content event handler.
abstract fun dtd_handler: nullable DTDHandler

sax :: XMLReader :: dtd_handler

Return the current DTD handler.
abstract fun dtd_handler=(handler: nullable DTDHandler)

sax :: XMLReader :: dtd_handler=

Allow an application to register a DTD event handler.
abstract fun entity_resolver: nullable EntityResolver

sax :: XMLReader :: entity_resolver

Return the current entity resolver.
abstract fun entity_resolver=(resolver: nullable EntityResolver)

sax :: XMLReader :: entity_resolver=

Allow an application to register an entity resolver.
abstract fun error_handler: nullable ErrorHandler

sax :: XMLReader :: error_handler

Return the current error handler.
abstract fun error_handler=(handler: nullable ErrorHandler)

sax :: XMLReader :: error_handler=

Allow an application to register an error event handler.
abstract fun feature(name: String): Bool

sax :: XMLReader :: feature

Look up the value of a feature flag.
abstract fun feature=(name: String, value: Bool)

sax :: XMLReader :: feature=

Set the value of a feature flag.
abstract fun feature_readable(name: String): Bool

sax :: XMLReader :: feature_readable

Is the retrieval of the specified feature flag supported given the current context?
abstract fun feature_recognized(name: String): Bool

sax :: XMLReader :: feature_recognized

Is the specified feature flag recognized by this parser?
abstract fun feature_writable(name: String): Bool

sax :: XMLReader :: feature_writable

Is the modification of the specified feature flag supported given the current context?
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
abstract fun parse(input: InputSource)

sax :: XMLReader :: parse

Parse an XML document.
abstract fun parse_file(system_id: String)

sax :: XMLReader :: parse_file

Parse an XML document from a system identifier (URI).
abstract fun property(name: String): nullable Object

sax :: XMLReader :: property

Look up the value of a property.
abstract fun property=(name: String, value: nullable Object)

sax :: XMLReader :: property=

Set the value of a property.
abstract fun property_readable(name: String): Bool

sax :: XMLReader :: property_readable

Is the retrieval of the specified property supported given the current context?
abstract fun property_recognized(name: String): Bool

sax :: XMLReader :: property_recognized

Is the specified property recognized by this parser?
abstract fun property_writable(name: String): Bool

sax :: XMLReader :: property_writable

Is the modification of the specified property supported given the current context?
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
package_diagram sax::XMLReader XMLReader core::Object Object sax::XMLReader->core::Object sax::XMLFilter XMLFilter sax::XMLFilter->sax::XMLReader saxophonit::XophonReader XophonReader saxophonit::XophonReader->sax::XMLReader sax::XMLFilterImpl XMLFilterImpl sax::XMLFilterImpl->sax::XMLFilter sax::XMLFilterImpl... ... sax::XMLFilterImpl...->sax::XMLFilterImpl

Parents

interface Object

core :: Object

The root of the class hierarchy.

Children

interface XMLFilter

sax :: XMLFilter

Interface for an XML filter.
class XophonReader

saxophonit :: XophonReader

Implementation of the XMLReader interface.

Descendants

class SAXEventLogger

saxophonit :: SAXEventLogger

A filter that internally log events it recieves.
class XMLFilterImpl

sax :: XMLFilterImpl

Base class for deriving an XML filter.

Class definitions

sax $ XMLReader
# Interface for reading an XML document using callbacks.
#
# `XMLReader` is the interface that an XML parser's SAX2 driver must
# implement. This interface allows an application to set and
# query features and properties in the parser, to register
# event handlers for document processing, and to initiate
# a document parse.
#
# All SAX interfaces are assumed to be synchronous: the
# `parse` methods must not return until parsing
# is complete, and readers must wait for an event-handler callback
# to return before reporting the next event.
#
# Note: The original documentation comes from [SAX 2.0](http://www.saxproject.org).
interface XMLReader

	# Is the specified feature flag recognized by this parser?
	#
	# Parameter:
	#
	# * `name`: feature name, which is a fully-qualified URI.
	fun feature_recognized(name: String): Bool is abstract

	# Is the retrieval of the specified feature flag supported given the current context?
	#
	# Parameter:
	#
	# * `name`: feature name, which is a fully-qualified URI.
	fun feature_readable(name: String): Bool is abstract

	# Is the modification of the specified feature flag supported given the current context?
	#
	# Parameter:
	#
	# * `name`: feature name, which is a fully-qualified URI.
	fun feature_writable(name: String): Bool is abstract

	# Look up the value of a feature flag.
	#
	# The feature name is any fully-qualified URI. It is
	# possible for an `XMLReader` to recognize a feature name but
	# temporarily be unable to return its value.
	# Some feature values may be available only in specific
	# contexts, such as before, during, or after a parse.
	# Also, some feature values may not be programmatically accessible.
	#
	# All XMLReaders are required to recognize the
	# `http://xml.org/sax/features/namespaces` and the
	# `http://xml.org/sax/features/namespace-prefixes` feature names.
	#
	# Implementors are free (and encouraged) to invent their own features,
	# using names built on their own URIs.
	#
	# Parameter:
	#
	# * `name`: feature name, which is a fully-qualified URI.
	#
	# Returns:
	#
	# The current value of the feature.
	#
	# SEE: `feature_recognized`
	#
	# SEE: `feature_readable`
	fun feature(name: String): Bool is abstract

	# Set the value of a feature flag.
	#
	# The feature name is any fully-qualified URI. It is
	# possible for an XMLReader to expose a feature value but
	# to be unable to change the current value.
	# Some feature values may be immutable or mutable only
	# in specific contexts, such as before, during, or after
	# a parse.
	#
	# All XMLReaders are required to support setting
	# http://xml.org/sax/features/namespaces to true and
	# http://xml.org/sax/features/namespace-prefixes to false.
	#
	# Parameters:
	#
	# * `name`: feature name, which is a fully-qualified URI.
	# * `value`: requested value of the feature.
	#
	# SEE: `feature_recognized`
	#
	# SEE: `feature_writable`
	fun feature=(name: String, value: Bool) is abstract

	# Is the specified property recognized by this parser?
	#
	# Parameter:
	#
	# * `name`: property name, which is a fully-qualified URI.
	fun property_recognized(name: String): Bool is abstract

	# Is the retrieval of the specified property supported given the current context?
	#
	# Parameter:
	#
	# * `name`: property name, which is a fully-qualified URI.
	fun property_readable(name: String): Bool is abstract

	# Is the modification of the specified property supported given the current context?
	#
	# Parameter:
	#
	# * `name`: property name, which is a fully-qualified URI.
	fun property_writable(name: String): Bool is abstract

	# Look up the value of a property.
	#
	# The property name is any fully-qualified URI. It is
	# possible for an `XMLReader` to recognize a property name but
	# temporarily be unable to return its value.
	# Some property values may be available only in specific
	# contexts, such as before, during, or after a parse.
	#
	# XMLReaders are not required to recognize any specific
	# property names, though an initial core set is documented for
	# SAX2.
	#
	# Implementors are free (and encouraged) to invent their own properties,
	# using names built on their own URIs.
	#
	# Parameter:
	#
	# * `name`: property name, which is a fully-qualified URI.
	#
	# Returns:
	#
	# The current value of the property.
	#
	# SEE: `property_recognized`
	#
	# SEE: `property_supported`
	fun property(name: String): nullable Object is abstract

	# Set the value of a property.
	#
	# The property name is any fully-qualified URI. It is
	# possible for an `XMLReader` to recognize a property name but
	# to be unable to change the current value.
	# Some property values may be immutable or mutable only
	# in specific contexts, such as before, during, or after
	# a parse.
	#
	# XMLReaders are not required to recognize setting
	# any specific property names, though a core set is defined by
	# SAX2.
	#
	# This method is also the standard mechanism for setting
	# extended handlers.
	#
	# Parameters:
	#
	# * `name`: property name, which is a fully-qualified URI.
	# * `value`: requested value for the property.
	#
	# SEE: `property_recognized`
	#
	# SEE: `property_writable`
	fun property=(name: String, value: nullable Object) is abstract

	# Allow an application to register an entity resolver.
	#
	# If the application does not register an entity resolver,
	# the XMLReader will perform its own default resolution.
	#
	# Applications may register a new or different resolver in the
	# middle of a parse, and the SAX parser must begin using the new
	# resolver immediately.
	fun entity_resolver=(resolver: nullable EntityResolver) is abstract

	# Return the current entity resolver.
	#
	# Return `null` if none has been registered.
	fun entity_resolver: nullable EntityResolver is abstract

	# Allow an application to register a DTD event handler.
	#
	# If the application does not register a DTD handler, all DTD
	# events reported by the SAX parser will be silently ignored.
	#
	# Applications may register a new or different handler in the
	# middle of a parse, and the SAX parser must begin using the new
	# handler immediately.
	fun dtd_handler=(handler: nullable DTDHandler) is abstract

	# Return the current DTD handler.
	#
	# Return `null` if none has been registered.
	fun dtd_handler: nullable DTDHandler is abstract

	# Allow an application to register a content event handler.
	#
	# If the application does not register a content handler, all
	# content events reported by the SAX parser will be silently
	# ignored.
	#
	# Applications may register a new or different handler in the
	# middle of a parse, and the SAX parser must begin using the new
	# handler immediately.
	fun content_handler=(handler: nullable ContentHandler) is abstract

	# Return the current content handler.
	#
	# Return `null` if none has been registered.
	fun content_handler: nullable ContentHandler is abstract

	# Allow an application to register an error event handler.
	#
	# If the application does not register an error handler, all
	# error events reported by the SAX parser will be silently
	# ignored; however, normal processing may not continue. It is
	# highly recommended that all SAX applications implement an
	# error handler to avoid unexpected bugs.
	#
	# Applications may register a new or different handler in the
	# middle of a parse, and the SAX parser must begin using the new
	# handler immediately.
	fun error_handler=(handler: nullable ErrorHandler) is abstract

	# Return the current error handler.
	#
	# Return `null` if none has been registered.
	fun error_handler: nullable ErrorHandler is abstract

	# Parse an XML document.
	#
	# The application can use this method to instruct the XML
	# reader to begin parsing an XML document from any valid input
	# source (a byte stream or an URI).
	#
	# Applications may not invoke this method while a parse is in
	# progress (they should create a new `XMLReader` instead for each
	# nested XML document). Once a parse is complete, an
	# application may reuse the same `XMLReader` object, possibly with a
	# different input source.
	#
	# During the parse, the `XMLReader` will provide information
	# about the XML document through the registered event
	# handlers.
	#
	# This method is synchronous: it will not return until parsing
	# has ended. If a client application wants to terminate
	# parsing early, it should throw an exception.
	#
	# Parameters:
	#
	# * `source`: input source for the top-level of the XML document.
	fun parse(input: InputSource) is abstract

	# Parse an XML document from a system identifier (URI).
	#
	# This method is a shortcut for the common case of reading a
	# document from a system identifier. It is the exact
	# equivalent of the following:
	#
	# ~~~nitish
	# var source = new InputSouce
	# source.system_id = system_id
	# parse(source)
	# ~~~
	#
	# If the system identifier is a URL, it must be fully resolved
	# by the application before it is passed to the parser.
	#
	# Parameters:
	#
	# * `systemId`: The system identifier (URI).
	fun parse_file(system_id: String) is abstract
end
lib/sax/xml_reader.nit:19,1--291,3