Class Summary : TInputSource

A single input source for an XML entity.
This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY.

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/or a byte 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 IParser.parse or IXMLReader.parse method, or as the return value of the IEntityResolver.resolveEntity method.

The SAX parser will use the InputSource object to determine how to read XML input. If there is a byte stream available, the parser will read that stream directly, disregarding any text encoding declaration found in that stream. If there is no character stream, but 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 neither a character stream nor a a byte stream is available, the parser will attempt to open a URI connection to the resource identified by the system identifier (this may be done using a TFilestream).

For alternate InputSources sych as ones which implement byte streams see IStreamInputSource. Implementors are encouraged to create alternate InputSources, but should be aware that readers must be created that support them.

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 both byte and character streams is to close them as part of end-of-parse cleanup, which means that the stream will be freed. Applications should not attempt to re-use such streams after they have been handed to a parser.


Since : SAX 1.0
See : IXMLReader.parse(IInputSource)
See : IEntityResolver.resolveEntity

Methods

procedure setPublicId(SAXString)
function getPublicId() : SAXString
procedure setSystemId(SAXString)
function getSystemId() : SAXString
procedure setEncoding(SAXString)
function getEncoding() : SAXString


procedure setPublicId(const publicId : SAXString);

Set the public identifier for this input source.

The public identifier is always optional: if the application writer includes one, it will be provided as part of the location information.


Parameter : publicId The public identifier as a string.
See : TInputSource.getPublicId
See : ILocator.getPublicId
See : ESAXParseException.getPublicId

Top


function getPublicId() : SAXString;

Get the public identifier for this input source.
Result : The public identifier, or an empty string if none was supplied.
See : TInputSource.setPublicId

Top


procedure setSystemId(const systemId : SAXString);

Set the system identifier for this input source.

The system identifier is optional if there is a byte stream or a character stream, but it is still useful to provide one, since the application can use it to resolve relative URIs and can include it in error messages and warnings (the parser will attempt to open a connection to the URI only if there is no byte stream specified).

If the application knows the character encoding of the object pointed to by the system identifier, it can register the encoding using the setEncoding method.

If the system identifier is a URL, it must be fully resolved (it may not be a relative URL).


Parameter : systemId The system identifier as a string.
See : TInputSource.setEncoding
See : TInputSource.getSystemId
See : ILocator.getSystemId
See : ESAXParseException.getSystemId

Top


function getSystemId() : SAXString;

Get the system identifier for this input source.

The getEncoding method will return the character encoding of the object pointed to, or an empty string if unknown.

If the system ID is a URL, it will be fully resolved.


Result : The system identifier, or a blank string if none was supplied.
See : TInputSource.setSystemId
See : TInputSource.getEncoding

Top


procedure setEncoding(const encoding : SAXString);

Set 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).


Parameter : encoding A string describing the character encoding.
See : TInputSource.setSystemId
See : TInputSource.setByteStream
See : TInputSource.getEncoding

Top


function getEncoding() : SAXString;

Get the character encoding for a byte stream or URI.
Result : The encoding, or an empty string if none was supplied.
See : TInputSource.setByteStream
See : TInputSource.getSystemId
See : TInputSource.getByteStream

Top