|
Unicorn XML Toolkit Version 1.50.00 |
|||||||||
� PREV CLASS �� NEXT CLASS | FRAMES��NO FRAMES | |||||||||
SUMMARY: � CONSTR �|� FUNCTION �|�DATA | DETAIL: � CONSTR �|� FUNCTION �|�DATA |
class CXmlWriter: public Sax::CContentHandler { public: CXmlWriter(CToolkitBase *pToolkitBase); ~CXmlWriter(); public: void SetDocumentLocator(Sax::CLocator *pLocator); void StartDocument(); void EndDocument(); void StartPrefixMapping( const WCHAR *pszPrefix, const WCHAR *pszUri); void EndPrefixMapping(const WCHAR *pszPrefix); void StartElement( const WCHAR *pszUri, const WCHAR *pszLocalName, const WCHAR *pszQName, Sax::CAttributes *pAtts); void EndElement( const WCHAR *pszUri, const WCHAR *pszLocalName, const WCHAR *pszQName); void Characters(const WCHAR *pCh, int nLength); void IgnorableWhitespace(const WCHAR *pCh, int nLength); void ProcessingInstruction( const WCHAR *pszTarget, const WCHAR *pszData); void SkippedEntity(const WCHAR *pszName); public: void SetUri(const WCHAR *pszUri); bool GetUri(CString &strUri); void SetByteStream(IStream *pByteStream); bool GetByteStream(IStream *&pByteStream); void SetCharacterStream(IUnicodeStream *pCharacterStream); bool GetCharacterStream(IUnicodeStream *&pCharacterStream); void SetNamespaces(bool bNamespaces); bool GetNamespaces(bool &bNamespaces); void SetMethod(const WCHAR *pszMethod); bool GetMethod(CString &strMethod); void SetVersion(const WCHAR *pszVersion); bool GetVersion(CString &strVersion); void SetEncoding(const WCHAR *pszEncoding); bool GetEncoding(CString &strEncoding); void SetOmitXmlDeclaration(bool bOmitXmlDeclaration); bool GetOmitXmlDeclaration(bool &bOmitXmlDeclaration); void SetStandalone(bool bStandalone); bool GetStandalone(bool &bStandalone); void SetDoctypePublic(const WCHAR *pszDoctypePublic); bool GetDoctypePublic(CString &strDoctypePublic); void SetDoctypeSystem(const WCHAR *pszDoctypeSystem); bool GetDoctypeSystem(CString &strDoctypeSystem); void SetIndent(bool bIndent); bool GetIndent(bool &bIndent); void SetMediaType(const WCHAR *pszMediaType); bool GetMediaType(CString &strMediaType); }; typedef XInterface<CXmlWriter> XXmlWriter;
The general-purpose XML writer designed to transform SAX content event streams into their text-based representation using XML, HTML, or plain text formats.
XML writer is represented as the subclass of
SAX content handler (see
Sax::CContentHandler
).
It accepts the stream of XML content events as input.
The application programmer must specify whether
the input stream is expected to perform namespace
processing (see
Sax
for the detailed
discussion of the namespace processing in SAX).
XML writer generates the output text stream in the specified format and sends it to a specified target URI, a byte stream, or a Unicode character stream.
XML writer engine is modeled after the output facility specified in XSL Transformations (XSLT) Version 1.0.
In particular, every XML writer owns a collection of properties
corresponding to various attributes specified for XSLT
xsl:output
element. For each property
the
CXmlWriter
class provides a pair of member
functions designed to get or set the property value.
Each property may be assigned a particular value,
or may be undefined.
Following is the complete list of writer properties. Refer to XSL Transformations (XSLT) Version 1.0 for the detailed description of semantics of these properties.
method
attribute on
xsl:output
.version
attribute on
xsl:output
.encoding
attribute on
xsl:output
.omit-xml-declaration
attribute on
xsl:output
.standalone
attribute on
xsl:output
.doctype-system
attribute on
xsl:output
.doctype-public
attribute on
xsl:output
.indent
attribute on
xsl:output
.media-type
attribute on
xsl:output
.Additionally, there are few writer properties which have no equivalent in XSLT:
Uri
for details
of the URI support).
CToolkitBase, Sax::CAttributes, Sax::CLocator
Constructor/Destructor Summary | |
CXmlWriter
(CToolkitBase *pToolkitBase);
����������Constructs the XML writer. |
|
~CXmlWriter
();
����������Destroys the XML writer. |
Function Summary | |
void
|
SetDocumentLocator
(Sax::CLocator *pLocator);
����������Receives an object for locating the origin of SAX content events. |
void
|
StartDocument
();
����������Receives notification of the beginning of a document. |
void
|
EndDocument
();
����������Receives notification of the end of a document. |
void
|
StartPrefixMapping
(const WCHAR *pszPrefix, const WCHAR *pszUri);
����������Begins the scope of a namespace prefix-URI mapping. |
void
|
EndPrefixMapping
(const WCHAR *pszPrefix);
����������Ends the scope of a namespace prefix-URI mapping. |
void
|
StartElement
(const WCHAR *pszUri, const WCHAR *pszLocalName, const WCHAR *pszQName, Sax::CAttributes *pAtts);
����������Receives notification of the beginning of an element. |
void
|
EndElement
(const WCHAR *pszUri, const WCHAR *pszLocalName, const WCHAR *pszQName);
����������Receives notification of the end of an element. |
void
|
Characters
(const WCHAR *pCh, int nLength);
����������Receives notification of character data. |
void
|
IgnorableWhitespace
(const WCHAR *pCh, int nLength);
����������Receives notification of ignorable whitespace in element content. |
void
|
ProcessingInstruction
(const WCHAR *pszTarget, const WCHAR *pszData);
����������Receives notification of a processing instruction. |
void
|
SkippedEntity
(const WCHAR *pszName);
����������Receives notification of a skipped entity. |
void
|
SetUri
(const WCHAR *pszUri);
����������Sets the target URI. |
bool
|
GetUri
(CString &strUri);
����������Queries the target URI. |
void
|
SetByteStream
(IStream *pByteStream);
����������Sets the target byte stream. |
bool
|
GetByteStream
(IStream *&pByteStream);
����������Queries the target byte stream. |
void
|
SetCharacterStream
(IUnicodeStream *pCharacterStream);
����������Sets the target Unicode character stream. |
bool
|
GetCharacterStream
(IUnicodeStream *&pCharacterStream);
����������Queries the target Unicode character stream. |
void
|
SetNamespaces
(bool bNamespaces);
����������Sets the namespace processing indicator. |
bool
|
GetNamespaces
(bool &bNamespaces);
����������Queries the namespace processing indicator. |
void
|
SetMethod
(const WCHAR *pszMethod);
����������Sets the name of the output method. |
bool
|
GetMethod
(CString &strMethod);
����������Queries the name of the output method. |
void
|
SetVersion
(const WCHAR *pszVersion);
����������Sets the version of the output method. |
bool
|
GetVersion
(CString &strVersion);
����������Queries the version of the output method. |
void
|
SetEncoding
(const WCHAR *pszEncoding);
����������Sets the preferred character encoding. |
bool
|
GetEncoding
(CString &strEncoding);
����������Queries the preferred character encoding. |
void
|
SetOmitXmlDeclaration
(bool bOmitXmlDeclaration);
����������Sets the omit XML declaration indicator. |
bool
|
GetOmitXmlDeclaration
(bool &bOmitXmlDeclaration);
����������Queries the omit XML declaration indicator. |
void
|
SetStandalone
(bool bStandalone);
����������Sets the standalone indicator. |
bool
|
GetStandalone
(bool &bStandalone);
����������Queries the standalone indicator. |
void
|
SetDoctypePublic
(const WCHAR *pszDoctypePublic);
����������Sets the document type public identifier. |
bool
|
GetDoctypePublic
(CString &strDoctypePublic);
����������Queries the document type system identifier. |
void
|
SetDoctypeSystem
(const WCHAR *pszDoctypeSystem);
����������Sets the document type system identifier. |
bool
|
GetDoctypeSystem
(CString &strDoctypeSystem);
����������Queries the document type public identifier. |
void
|
SetIndent
(bool bIndent);
����������Sets the indent indicator. |
bool
|
GetIndent
(bool &bIndent);
����������Queries the indent indicator. |
void
|
SetMediaType
(const WCHAR *pszMediaType);
����������Sets the media type. |
bool
|
GetMediaType
(CString &strMediaType);
����������Queries the media type. |
Constructor/Destructor Detail |
CXmlWriter(CToolkitBase *pToolkitBase);
Constructs the XML writer.
pToolkitBase
- the master toolkit base~CXmlWriter();
Destroys the XML writer.
Function Detail |
void SetDocumentLocator(Sax::CLocator *pLocator);
Receives an object for locating the origin of SAX content events.
pLocator
- an object that can return the location of
any SAX content eventvoid StartDocument();
Receives notification of the beginning of a document.
void EndDocument();
Receives notification of the end of a document.
void StartPrefixMapping( const WCHAR *pszPrefix, const WCHAR *pszUri);
Begins the scope of a namespace prefix-URI mapping.
pszPrefix
- the namespace prefix being declaredpszUri
- the namespace URI the prefix is mapped tovoid EndPrefixMapping(const WCHAR *pszPrefix);
Ends the scope of a namespace prefix-URI mapping.
pszPrefix
- the prefix that was being mappedvoid StartElement( const WCHAR *pszUri, const WCHAR *pszLocalName, const WCHAR *pszQName, Sax::CAttributes *pAtts);
Receives notification of the beginning of an element.
pszUri
- the namespace URI, or the empty string if the
element has no namespace URI or if namespace
processing is not being performedpszLocalName
- the local name (without prefix), or the
empty string if namespace processing is not being
performedpszQName
- the qualified name (with prefix), or the
empty string if qualified names are not availablepAtts
- the list of
attributes attached to the element. If
there are no attributes, it shall be empty.void EndElement( const WCHAR *pszUri, const WCHAR *pszLocalName, const WCHAR *pszQName);
Receives notification of the end of an element.
pszUri
- the namespace URI, or the empty string if the
element has no namespace URI or if namespace
processing is not being performedpszLocalName
- the local name (without prefix), or the
empty string if namespace processing is not being
performedpszQName
- the qualified name (with prefix), or the
empty string if qualified names are not availablevoid Characters(const WCHAR *pCh, int nLength);
Receives notification of character data.
pCh
- the array of characters
from the XML documentnLength
- the number of characters
to read from the arrayvoid IgnorableWhitespace(const WCHAR *pCh, int nLength);
Receives notification of ignorable whitespace in element content.
pCh
- the array of characters
from the XML documentnLength
- the number of characters
to read from the arrayvoid ProcessingInstruction( const WCHAR *pszTarget, const WCHAR *pszData);
Receives notification of a processing instruction.
pszTarget
- the processing instruction targetpszData
- the processing instruction data,
or the empty string if none was suppliedvoid SkippedEntity(const WCHAR *pszName);
Receives notification of a skipped entity.
pszName
- the name of the skipped entityvoid SetUri(const WCHAR *pszUri);
Sets the target URI.
pszUri
- the string representing
the target URIbool GetUri(CString &strUri);
Queries the target URI.
strUri
- on return, the string representing
the target URI, if definedtrue
if the target URI is defined;
false
otherwisevoid SetByteStream(IStream *pByteStream);
Sets the target byte stream.
pByteStream
- the target byte streambool GetByteStream(IStream *&pByteStream);
Queries the target byte stream.
pByteStream
- on return, the target byte stream,
if definedtrue
if the target byte stream is defined;
false
otherwisevoid SetCharacterStream(IUnicodeStream *pCharacterStream);
Sets the target Unicode character stream.
pCharacterStream
- the target Unicode
character streambool GetCharacterStream(IUnicodeStream *&pCharacterStream);
Queries the target Unicode character stream.
pCharacterStream
- on return, the target
Unicode character stream, if definedtrue
if the target Unicode character stream
is defined;
false
otherwisevoid SetNamespaces(bool bNamespaces);
Sets the namespace processing indicator.
bNamespaces
- the boolean namespace
processing indicatorbool GetNamespaces(bool &bNamespaces);
Queries the namespace processing indicator.
bNamespaces
- on return, the boolean
namespace processing indicator, if definedtrue
if the namespace processing
indicator is defined;
false
otherwisevoid SetMethod(const WCHAR *pszMethod);
Sets the name of the output method.
The supported method names are
"xml"
,
"html"
, and
"text"
.
pszMehod
- the name of the output methodbool GetMethod(CString &strMethod);
Queries the name of the output method.
strMethod
- on return, the name of the output
method, if definedtrue
if the name of the output
method is defined;
false
otherwisevoid SetVersion(const WCHAR *pszVersion);
Sets the version of the output method.
pszVersion
- the version of the output methodbool GetVersion(CString &strVersion);
Queries the version of the output method.
strVersion
- on return, the version of
the output method, if definedtrue
if the version of
the output method is defined,
false
otherwisevoid SetEncoding(const WCHAR *pszEncoding);
Sets the preferred character encoding.
See
Unicode
for the list of supported
encoding names.
pszEncoding
- the string representing
the encoding namebool GetEncoding(CString &strEncoding);
Queries the preferred character encoding.
strEncoding
- on return, the string
representing the encoding name, if definedtrue
if the encoding name is defined;
false
otherwisevoid SetOmitXmlDeclaration(bool bOmitXmlDeclaration);
Sets the omit XML declaration indicator.
bOmitXmlDeclaration
- the boolean omit XML
declaration indicatorbool GetOmitXmlDeclaration(bool &bOmitXmlDeclaration);
Queries the omit XML declaration indicator.
bOmitXmlDeclaration
- on return, the boolean
XML declaration indicator, if definedtrue
if the omit XML declaration
indicator is defined;
false
otherwisevoid SetStandalone(bool bStandalone);
Sets the standalone indicator.
bStandalone
- the boolean standalone indicatorbool GetStandalone(bool &bStandalone);
Queries the standalone indicator.
bStandalone
- on return, the boolean
standalone indicator, if definedtrue
if the standalone indicator
is defined;
false
otherwisevoid SetDoctypePublic(const WCHAR *pszDoctypePublic);
Sets the document type public identifier.
pszDoctypePublic
- the string representing
the document type public identifierbool GetDoctypePublic(CString &strDoctypePublic);
Queries the document type system identifier.
strDoctypePublic
- on return, the string
representing the document type system identifier,
if definedtrue
if the document system
identifier is defined;
false
otherwisevoid SetDoctypeSystem(const WCHAR *pszDoctypeSystem);
Sets the document type system identifier.
pszDoctypeSystem
- the string representing
the document type system identifierbool GetDoctypeSystem(CString &strDoctypeSystem);
Queries the document type public identifier.
strDoctypeSystem
- on return, the string
representing the document type public identifier,
if definedtrue
if the document system
identifier is defined;
false
otherwisevoid SetIndent(bool bIndent);
Sets the indent indicator.
bIndent
- the boolean indent indicatorbool GetIndent(bool &bIndent);
Queries the indent indicator.
bIndent
- on return, the boolean indent
indicator, if definedtrue
if the indent indicator is
defined;
false
otherwisevoid SetMediaType(const WCHAR *pszMediaType);
Sets the media type.
strMediaType
- the string representing
the media typebool GetMediaType(CString &strMediaType);
Queries the media type.
strMediaType
- on return, the string
representing the media type, if definedtrue
if the media type is defined;
false
otherwise
|
Unicorn XML Toolkit Version 1.50.00 |
|||||||||
� PREV CLASS �� NEXT CLASS | FRAMES��NO FRAMES | |||||||||
SUMMARY: � CONSTR �|� FUNCTION �|�DATA | DETAIL: � CONSTR �|� FUNCTION �|�DATA |