class InputSource

A single input source for an XML entity

Inheritance:


Public

Constructors and Destructor
InputSource (const char* const systemId)
Create a new input source with a system identifier
InputSource ( const char* const systemId, const char* const publicId )
Create a new input source with a system identifier and a public identifier
virtual ~InputSource ()
Destructor
Getter methods
const XMLCh* getEncoding () const
Get the name of the encoding that is to be forced
const XMLCh* getPublicId () const
Get the public identifier for this input source
const XMLCh* getSystemId () const
Get the system identifier for this input source
Setter methods
void setEncoding (const XMLCh* const encodingStr)
Set the encoding which will be required for use with the XML text read via a stream opened by this input source
void setPublicId (const XMLCh* const publicId)
Set the public identifier for this input source
void setSystemId (const XMLCh* const systemId)
Set the system identifier for this input source
Virtual input source interface
virtual BinInputStream* makeStream () const
Makes the byte stream for this input source

Documentation

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 or a system identifier

There are two places that the application will deliver this input source to the parser: as the argument to the Parser.parse method, or as the return value of the EntityResolver.resolveEntity method.

The SAX parser will use the InputSource object to determine how to read XML input. If there is a character stream available, the parser will read that stream directly; if not, the parser will use a byte stream, if available; if neither a character stream nor a 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).

Constructors and Destructor

InputSource(const char* const systemId)
Create a new input source with a system identifier.

Applications may use setPublicId to include a public identifier as well

If the system identifier is a URL, it must be full resolved.

Parameters:
systemId - The system identifier (URI).
See Also:
setPublicId
setSystemId
setByteStream
setCharacterStream

InputSource( const char* const systemId, const char* const publicId )
Create a new input source with a system identifier and a public identifier.

If the system identifier is a URL, it must be full resolved.

Parameters:
systemId - The system identifier (URI).
See Also:
setPublicId
setSystemId
setByteStream
setCharacterStream

virtual ~InputSource()
Destructor

Virtual input source interface

virtual BinInputStream* makeStream() const
Makes the byte stream for this input source.

The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself.

See Also:
getByteStream
InputStream

Getter methods

const XMLCh* getEncoding() const
Get the name of the encoding that is to be forced.
Returns:
The forced encoding, or null if none was supplied.
See Also:
setEncoding

const XMLCh* getPublicId() const
Get the public identifier for this input source.
Returns:
The public identifier, or null if none was supplied.
See Also:
setPublicId

const XMLCh* getSystemId() const
Get the system identifier for this input source.

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

Returns:
The system identifier.
See Also:
setSystemId

Setter methods

void setEncoding(const XMLCh* const encodingStr)
Set the encoding which will be required for use with the XML text read via a stream opened by this input source.

This is usually not set, allowing the encoding to be sensed in the usual XML way. However, in some cases, the encoding in the file is known to be incorrect because of intermediate transcoding, for instance encapsulation within a MIME document.

Parameters:
encodingStr - The name of the encoding to force.

void setPublicId(const XMLCh* const publicId)
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.

Parameters:
publicId - The public identifier as a string.
See Also:
getPublicId
getPublicId
getPublicId

void setSystemId(const XMLCh* const systemId)
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 or character stream specified).

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

Parameters:
systemId - The system identifier as a string.
See Also:
getSystemId
getSystemId
getSystemId


This class has no child classes.
Version:
Revision:
See Also:
parse
resolveEntity
InputStream
Reader

alphabetic index hierarchy of classes


XML Parser for C++ 2.0
Copyright © IBM Corp, 1999
Center for Java Technology
10275 N. De Anza Blvd.
Cupertino CA 95014 USA
Email: xml4c@us.ibm.com

IBM Logo