Unicorn XML Toolkit
Version 1.00.00

Namespace Sxp
Class CInputSource

class CInputSource: public CInterface {
public:
    CInputSource();
    CInputSource(IStream *pByteStream);
    CInputSource(IUnicodeStream *pCharacterStream);
    CInputSource(const CString &strSystemId);
    ~CInputSource();
public:
    void SetByteStream(IStream *pByteStream);
    IStream *GetByteStream() const;
    void SetCharacterStream(IUnicodeStream *pCharacterStream);
    IUnicodeStream *GetCharacterStream() const;
    void SetPublicId(const CString &strPublicId);
    CString GetPublicId() const;
    void SetSystemId(const CString &strSystemId);
    CString GetSystemId() const;
    void SetEncoding(const CString &strEncoding);
    CString GetEncoding() const;
    };

The input source for XML entities.

This class allows an SXP 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.

The SXP parser will use the input source to determine how to read XML input. If there is a character stream available, the parser will read the 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.

Since:
1.00.00
Version:
1.00.00
Author:
Alexey Gokhberg
Constructor/Destructor Summary
CInputSource ();
����������Constructs the input source.
CInputSource (IStream *pByteStream);
����������Constructs the input source with a byte stream.
CInputSource (IUnicodeStream *pCharacterStream);
����������Constructs the input source with a character stream.
CInputSource (const CString &strSystemId);
����������Constructs the input source with a system identifier.
~CInputSource ();
����������Destroys the input source.

Function Summary
void SetByteStream (IStream *pByteStream);
����������Sets the byte stream for this input source.
IStream�* GetByteStream ();
����������Gets the byte stream for this input source.
void SetCharacterStream (IUnicodeStream *pCharacterStream);
����������Sets the character stream for this input source.
IUnicodeStream�* GetCharacterStream () const;
����������Gets the character stream for this input source
void SetPublicId (const CString &strPublicId);
����������Sets the public identifier for this input source.
CString GetPublicId ();
����������Gets the public identifier for this input source.
void SetSystemId (const CString &strSystemId);
����������Sets the system identifier for this input source.
CString GetSystemId ();
����������Gets the system identifier for this input source.
void SetEncoding (const CString &strEncoding);
����������Sets the character encoding, if known.
CString GetEncoding ();
����������Gets the character encoding for a byte stream or URI.

Constructor/Destructor Detail

CInputSource

CInputSource();

Constructs the input source.

CInputSource

CInputSource(IStream *pByteStream);

Constructs the input source with a byte stream.

Parameters:
pByteStream - the raw byte stream containing the document or other entity

CInputSource

CInputSource(IUnicodeStream *pCharacterStream);

Constructs the input source with a character stream.

Parameters:
pCharacterStream - the character stream containing the document or other entity

CInputSource

CInputSource(const CString &strSystemId);

Constructs the input source with a system identifier.

Parameters:
strSystemId - the system identifier

~CInputSource

~CInputSource();

Destroys the input source.

Function Detail

SetByteStream

void SetByteStream(IStream *pByteStream);

Sets the byte stream for this input source.

The SXP 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.

If the application knows the character encoding of the byte stream, it should set it with the SetEncoding method.

Parameters:
pByteStream - the raw byte stream containing the document or other entity

GetByteStream

IStream *GetByteStream();

Gets the byte stream for this input source.

Returns:
the byte stream, or NULL if none was supplied

SetCharacterStream

void SetCharacterStream(IUnicodeStream *pCharacterStream);

Sets the character stream for this input source.

If there is a character stream specified, the parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.

Parameters:
pCharacterStream - the character stream containing the document or other entity

GetCharacterStream

IUnicodeStream *GetCharacterStream() const;

Gets the character stream for this input source

Returns:
the character stream, or NULL if non was supplied

SetPublicId

void SetPublicId(const CString &strPublicId);

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.

Parameters:
strPublicId - the public identifier

GetPublicId

CString GetPublicId();

Gets the public identifier for this input source.

Returns:
the public identifier, or the empty string if none was supplied

SetSystemId

void SetSystemId(const CString &strSystemId);

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 URI 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 application knows the character encoding of the object pointed to by the system identifier, it can register the encoding using the SetEncoding method.

Parameters:
strSystemId - the system identifier

GetSystemId

CString GetSystemId();

Gets the system identifier for this input source.

Returns:
the system identifier, or the empty string if none was supplied

SetEncoding

void SetEncoding(const CString &strEncoding);

Sets the character encoding, if known.

The encoding must be a string acceptable for an XML encoding declaration.

This method has no effect when the application provides a character stream.

Parameters:
strEncoding - a string describing the character encoding

GetEncoding

CString GetEncoding();

Gets the character encoding for a byte stream or URI.

Returns:
the encoding, or the empty string if none was supplied

Unicorn XML Toolkit
Version 1.00.00


This document was created using Unicorn DOC++.

Copyright 1999-2001 Unicorn Enterprises SA.
All Rights Reserved.