A single input source for an XML entity.

This class allows a SAX application to encapsulate information about an input source in a single object, which may include a public identifier, a system identifier and a stream (possibly with a specified encoding).

There are two places that the application can deliver an input source to the parser: as the argument to the XMLReader.parse method, or as the return value of the EntityResolver.resolve_entity method.

The SAX parser will use the InputSource object to determine how to read XML input. If there is a byte stream, the parser will use that byte stream, using the encoding specified in the InputSource or else (if no encoding is specified) autodetecting the character encoding using an algorithm such as the one in the XML specification. If no byte stream is available, the parser will attempt to open a URI connection to the resource identified by the system identifier.

An InputSource object belongs to the application: the SAX parser shall never modify it in any way (it may modify a copy if necessary). However, standard processing of the stream is to close it on as part of end-of-parse cleanup, so applications should not attempt to re-use such streams after they have been handed to a parser.

Note: The original documentation comes, in part, from SAX 2.0.

Introduced properties

fun encoding: nullable String

sax :: InputSource :: encoding

The character encoding, if known.
fun encoding=(encoding: nullable String)

sax :: InputSource :: encoding=

The character encoding, if known.
fun public_id: nullable String

sax :: InputSource :: public_id

The public identifier as a string.
fun public_id=(public_id: nullable String)

sax :: InputSource :: public_id=

The public identifier as a string.
fun stream: nullable Reader

sax :: InputSource :: stream

The stream containing the document.
fun stream=(stream: nullable Reader)

sax :: InputSource :: stream=

The stream containing the document.
fun system_id: nullable String

sax :: InputSource :: system_id

The system identifier as a string.
fun system_id=(system_id: nullable String)

sax :: InputSource :: system_id=

The system identifier as a string.
init with_stream(stream: Reader)

sax :: InputSource :: with_stream

Create a new input source with the specified stream.
init with_system_id(system_id: String)

sax :: InputSource :: with_system_id

Create a new input source with the specified system identifier.

Redefined properties

redef type SELF: InputSource

sax $ InputSource :: 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.
fun encoding: nullable String

sax :: InputSource :: encoding

The character encoding, if known.
fun encoding=(encoding: nullable String)

sax :: InputSource :: encoding=

The character encoding, if known.
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).
fun public_id: nullable String

sax :: InputSource :: public_id

The public identifier as a string.
fun public_id=(public_id: nullable String)

sax :: InputSource :: public_id=

The public identifier as a string.
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
fun stream: nullable Reader

sax :: InputSource :: stream

The stream containing the document.
fun stream=(stream: nullable Reader)

sax :: InputSource :: stream=

The stream containing the document.
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
fun system_id: nullable String

sax :: InputSource :: system_id

The system identifier as a string.
fun system_id=(system_id: nullable String)

sax :: InputSource :: system_id=

The system identifier as a string.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
init with_stream(stream: Reader)

sax :: InputSource :: with_stream

Create a new input source with the specified stream.
init with_system_id(system_id: String)

sax :: InputSource :: with_system_id

Create a new input source with the specified system identifier.
package_diagram sax::InputSource InputSource core::Object Object sax::InputSource->core::Object

Parents

interface Object

core :: Object

The root of the class hierarchy.

Class definitions

sax $ InputSource
# A single input source for an XML entity.
#
# This class allows a SAX application to encapsulate information
# about an input source in a single object, which may include
# a public identifier, a system identifier and a stream (possibly
# with a specified encoding).
#
# There are two places that the application can deliver an
# input source to the parser: as the argument to the `XMLReader.parse`
# method, or as the return value of the `EntityResolver.resolve_entity`
# method.
#
# The SAX parser will use the `InputSource` object to determine how to read XML
# input. If there is a byte stream, the parser will use that byte stream, using
# the encoding specified in the InputSource or else (if no encoding is
# specified) autodetecting the character encoding using an algorithm
# such as the one in the XML specification. If no byte stream is available, the
# parser will attempt to open a URI connection to the resource identified by
# the system identifier.
#
# An InputSource object belongs to the application: the SAX parser
# shall never modify it in any way (it may modify a copy if
# necessary). However, standard processing of the stream is to close it on as
# part of end-of-parse cleanup, so applications should not attempt to re-use
# such streams after they have been handed to a parser.
#
# Note: The original documentation comes, in part,
# from [SAX 2.0](http://www.saxproject.org).
class InputSource

	# Create a new input source with the specified system identifier.
	#
	# Applications may use `public_id=` to include a public identifier as well,
	# or `encoding=` to specify the character encoding, if known.
	#
	# If the system identifier is a URL, it must be fully resolved (it may not
	# be a relative URL).
	init with_system_id(system_id: String) do
		self.system_id = system_id
	end

	# Create a new input source with the specified stream.
	#
	# Application writers should use `system_id=` to provide a base for
	# resolving relative URIs, may use `public_id=` to include a public
	# identifier, and may use `encoding=` to specify the object's character
	# encoding.
	init with_stream(stream: Reader) do
		self.stream = stream
	end

	# The public identifier as a string.
	#
	# The public identifier is always optional: if the application
	# writer includes one, it will be provided as part of the
	# location information.
	var public_id: nullable String = null is writable

	# The system identifier as a string.
	#
	# If its an URL, it must be fully resolved (it may not be a relative URL).
	#
	# Applications may set `public_id` to include a
	# public identifier as well, or set `encoding` to specify
	# the character encoding, if known.
	var system_id: nullable String = null is writable

	# The stream containing the document.
	#
	# Application writers should set `system_id` to provide a base
	# for resolving relative URIs, may set `public_id` to include a
	# public identifier, and may set `encoding` to specify the object's
	# character encoding.
	var stream: nullable Reader = null is writable

	# The character encoding, if known.
	#
	# The encoding must be a string acceptable for an
	# XML encoding declaration (see section 4.3.3 of the XML 1.0
	# recommendation).
	var encoding: nullable String = null is writable
end
lib/sax/input_source.nit:14,1--95,3