|
Unicorn XML Toolkit Version 1.50.00 |
|||||||||
� PREV CLASS �� NEXT CLASS | FRAMES��NO FRAMES | |||||||||
SUMMARY: � CONSTR �|� FUNCTION �|�DATA | DETAIL: � CONSTR �|� FUNCTION �|�DATA |
class CInputSource: public CInterface { public: CInputSource(); CInputSource(const WCHAR *pszSystemId); CInputSource(IStream *pByteStream); CInputSource(IUnicodeStream *pCharacterStream); ~CInputSource(); public: void SetPublicId(const WCHAR *pszPublicId); const WCHAR *GetPublicId(); void SetSystemId(const WCHAR *pszSystemId); const WCHAR *GetSystemId(); void SetByteStream(IStream *pByteStream); IStream *GetByteStream(); void SetEncoding(const WCHAR *pszEncoding); const WCHAR *GetEncoding(); void SetCharacterStream(IUnicodeStream *pCharacterStream); IUnicodeStream *GetCharacterStream(); }; typedef XInterface<CInputSource> XInputSource;
The input source for 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, a byte stream (possibly with a specified encoding), and/or a character stream.
There are two places that the application will deliver this
input source to the reader: as the argument to
the
CXmlReader::Parse
method, or as the return value of the
CEntityResolver::ResolveEntity
method.
The SAX reader will use the input source object to determine how to read XML input. If there is a character stream available, the reader will read that stream directly; if not, the reader will use a byte stream, if available; if neither a character stream nor a byte stream is available, the reader will attempt to open a URI connection to the resource identified by the system identifier.
Input source object belongs to the application: the SAX reader shall never modify it in any way (it may modify a copy if necessary).
Constructor/Destructor Summary | |
CInputSource
();
����������Constructs the input source. |
|
CInputSource
(const WCHAR *pszSystemId);
����������Constructs the input source with a system identifier. |
|
CInputSource
(IStream *pByteStream);
����������Constructs the input source with a byte stream. |
|
CInputSource
(IUnicodeStream *pCharacterStream);
����������Constructs the input source with a character stream. |
|
~CInputSource
();
����������Destroys the input source. |
Function Summary | |
void
|
SetPublicId
(const WCHAR *pszPublicId);
����������Sets the public identifier for this input source. |
const�WCHAR�*
|
GetPublicId
();
����������Gets the public identifier for this input source. |
void
|
SetSystemId
(const WCHAR *pszSystemId);
����������Sets the system identifier for this input source. |
const�WCHAR�*
|
GetSystemId
();
����������Gets the system identifier for this input source. |
void
|
SetByteStream
(IStream *pByteStream);
����������Sets the byte stream for this input source. |
IStream�*
|
GetByteStream
();
����������Gets the byte stream for this input source. |
void
|
SetEncoding
(const WCHAR *pszEncoding);
����������Sets the character encoding, if known. |
const�WCHAR�*
|
GetEncoding
();
����������Gets the character encoding for a byte stream or URI. |
void
|
SetCharacterStream
(IUnicodeStream *pCharacterStream);
����������Sets the character stream for this input source. |
IUnicodeStream�*
|
GetCharacterStream
();
����������Gets the character stream for this input source. |
Constructor/Destructor Detail |
CInputSource();
Constructs the input source.
This is the zero-argument default constructor.
CInputSource(const WCHAR *pszSystemId);
Constructs the input source with a system identifier.
Applications may use
SetPublicId
to include a
public identifier as well, or
SetEncoding
to specify
the character encoding, if known.
If the system identifier is a URL, it must be fully resolved.
pszSystemId
- the system identifier (URI)CInputSource(IStream *pByteStream);
Constructs the input source with a byte stream.
Application writers may use
SetSystemId
to provide a base for resolving relative URIs,
SetPublicId
to include a
public identifier, and/or
SetEncoding
to specify the object's character encoding.
pByteStream
- the raw byte stream
containing the documentCInputSource(IUnicodeStream *pCharacterStream);
Constructs the input source with a character stream.
Application writers may use
SetSystemId
to provide a base
for resolving relative URIs, and
SetPublicId
to include a
public identifier.
The character stream shall not include a byte order mark.
pCharacterStream
- the character stream
containing the document~CInputSource();
Destroys the input source.
Function Detail |
void SetPublicId(const WCHAR *pszPublicId);
Sets 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.
pszPublicId
- the public identifier as a stringconst WCHAR *GetPublicId();
Gets the public identifier for this input source.
void SetSystemId(const WCHAR *pszSystemId);
Sets 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 reader will attempt to open a connection to the URI only if there is no byte stream or character 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 ID is a URL, it must be fully resolved.
pszSystemId
- the system identifier as a stringconst WCHAR *GetSystemId();
Gets the system identifier for this input source.
The
GetEncoding
method will return the character encoding
of the object pointed to, or the empty string if unknown.
If the system ID is a URL, it will be fully resolved.
void SetByteStream(IStream *pByteStream);
Sets the byte stream for this input source.
The SAX reader 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.
If the application knows the character encoding of the
byte stream, it should set it with the
SetEncoding
method.
pByteStream
- the byte stream containing
the XML document or other entityIStream *GetByteStream();
Gets the byte stream for this input source.
The
GetEncoding
method will return the character
encoding for this byte stream, or the empty string if unknown.
NULL
if none was suppliedvoid SetEncoding(const WCHAR *pszEncoding);
Sets 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).
This method has no effect when the application provides a character stream.
pszEncoding
- a string describing the character encodinconst WCHAR *GetEncoding();
Gets the character encoding for a byte stream or URI.
void SetCharacterStream(IUnicodeStream *pCharacterStream);
Sets the character stream for this input source.
If there is a character stream specified, the SAX reader will ignore any byte stream and will not attempt to open a URI connection to the system identifier.
pCharacterStream
- the character stream containing the
XML document or other entityIUnicodeStream *GetCharacterStream();
Gets the character stream for this input source.
NULL
if none was supplied
|
Unicorn XML Toolkit Version 1.50.00 |
|||||||||
� PREV CLASS �� NEXT CLASS | FRAMES��NO FRAMES | |||||||||
SUMMARY: � CONSTR �|� FUNCTION �|�DATA | DETAIL: � CONSTR �|� FUNCTION �|�DATA |