Unicorn XML Toolkit
Version 1.00.00

Namespace SaxDom
Class CWriter

class CWriter: public Sax::CContentHandler {
public:
    CWriter(const Dom::XNode &pNode);
    ~CWriter();
public:
    void SetNode(const Dom::XNode &pNode);
    Dom::XNode GetNode();
    void SetNamespaces(bool bNamespaces);
    bool GetNamespaces();
public:
    void SetDocumentLocator(const Sax::XLocator &pLocator);
    void StartDocument();
    void EndDocument();
    void StartPrefixMapping(
        const CString &strPrefix,
        const CString &strUri);
    void EndPrefixMapping(const CString &strPrefix);
    void StartElement(
        const CString &strUri,
        const CString &strLocalName,
        const CString &strQName,
        const Sax::XAttributes &pAtts);
    void EndElement(
        const CString &strUri,
        const CString &strLocalName,
        const CString &strQName);
    void Characters(const WCHAR *pCh, int nLength);
    void IgnorableWhitespace(const WCHAR *pCh, int nLength);
    void ProcessingInstruction(
        const CString &strTarget,
        const CString &strData);
    void SkippedEntity(const CString &strName);
    };

The DOM writer.

This class provides implementation of SAX content handler that consumes a sequence of SAX content events and builds a subtree rooted at the specified DOM/XDM node (called target subtree root).

Any DOM/XDM node which is allowed to have children may serve as a target subtree root. In particular, if an empty document node is specified as the root, the writer will build the entire document tree based on the content of the source events.

For each particular DOM writer, the application programmer can specify, whether source events must provide namespace information, obtained as the result of SAX namespace processing.

Since:
1.00.00
Version:
1.00.00
Author:
Alexey Gokhberg
See Also:
Dom::INode, Sax::CAttributes, Sax::CLocator
Constructor/Destructor Summary
CWriter (const Dom::XNode &pNode);
����������Constructs the writer.
~CWriter ();
����������Destroys the writer.

Function Summary
void SetNode (const Dom::XNode &pNode);
����������Specifies the target subtree root.
Dom::XNode GetNode ();
����������Returns the target subtree root.
void SetNamespaces (bool bNamespaces);
����������Specifies whether the source events must provide namespace information obtained as the result of SAX namespace processing.
bool GetNamespaces ();
����������Tests whether the source events must provide namespace information obtained as the result of SAX namespace processing.
void SetDocumentLocator (const Sax::XLocator &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 CString &strPrefix, const CString &strUri);
����������Begins the scope of a namespace prefix-URI mapping.
void EndPrefixMapping (const CString &strPrefix);
����������Ends the scope of a namespace prefix-URI mapping.
void StartElement (const CString &strUri, const CString &strLocalName, const CString &strQName, const Sax::XAttributes &pAtts);
����������Receives notification of the beginning of an element.
void EndElement (const CString &strUri, const CString &strLocalName, const CString &strQName);
����������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 CString &strTarget, const CString &strData);
����������Receives notification of a processing instruction.
void SkippedEntity (const CString &strName);
����������Receives notification of a skipped entity.

Constructor/Destructor Detail

CWriter

CWriter(const Dom::XNode &pNode);

Constructs the writer.

Parameters:
pNode - the node serving as the target subtree root

~CWriter

~CWriter();

Destroys the writer.

Function Detail

SetNode

void SetNode(const Dom::XNode &pNode);

Specifies the target subtree root.

Parameters:
pNode - the node serving as the target subtree root

GetNode

Dom::XNode GetNode();

Returns the target subtree root.

Returns:
the node serving as the target subtree root; NULL if none was specified

SetNamespaces

void SetNamespaces(bool bNamespaces);

Specifies whether the source events must provide namespace information obtained as the result of SAX namespace processing.

Parameters:
bNamespaces - true if namespace information is required in the source; false otherwise

GetNamespaces

bool GetNamespaces();

Tests whether the source events must provide namespace information obtained as the result of SAX namespace processing.

Returns:
true if namespace information is required in the source; false otherwise

SetDocumentLocator

void SetDocumentLocator(const Sax::XLocator &pLocator);

Receives an object for locating the origin of SAX content events.

Parameters:
pLocator - an object that can return the location of any SAX content event

StartDocument

void StartDocument();

Receives notification of the beginning of a document.

EndDocument

void EndDocument();

Receives notification of the end of a document.

StartPrefixMapping

void StartPrefixMapping(
    const CString &strPrefix,
    const CString &strUri);

Begins the scope of a namespace prefix-URI mapping.

Parameters:
strPrefix - the namespace prefix being declared
strUri - the namespace URI the prefix is mapped to

EndPrefixMapping

void EndPrefixMapping(const CString &strPrefix);

Ends the scope of a namespace prefix-URI mapping.

Parameters:
strPrefix - the prefix that was being mapped

StartElement

void StartElement(
    const CString &strUri,
    const CString &strLocalName,
    const CString &strQName,
    const Sax::XAttributes &pAtts);

Receives notification of the beginning of an element.

Parameters:
strUri - the namespace URI, or the empty string if the element has no namespace URI or if namespace processing is not being performed
strLocalName - the local name (without prefix), or the empty string if namespace processing is not being performed
strQName - the qualified name (with prefix), or the empty string if qualified names are not available
pAtts - the list of attributes attached to the element. If there are no attributes, it shall be an empty

EndElement

void EndElement(
    const CString &strUri,
    const CString &strLocalName,
    const CString &strQName);

Receives notification of the end of an element.

Parameters:
strUri - the namespace URI, or the empty string if the element has no namespace URI or if namespace processing is not being performed
strLocalName - the local name (without prefix), or the empty string if namespace processing is not being performed
strQName - the qualified name (with prefix), or the empty string if qualified names are not available

Characters

void Characters(const WCHAR *pCh, int nLength);

Receives notification of character data.

Parameters:
pCh - the array of characters from the XML document
nLength - the number of characters to read from the array

IgnorableWhitespace

void IgnorableWhitespace(const WCHAR *pCh, int nLength);

Receives notification of ignorable whitespace in element content.

Parameters:
pCh - the array of characters from the XML document
nLength - the number of characters to read from the array

ProcessingInstruction

void ProcessingInstruction(
    const CString &strTarget,
    const CString &strData);

Receives notification of a processing instruction.

Parameters:
strTarget - the processing instruction target
strData - the processing instruction data, or the empty string if none was supplied

SkippedEntity

void SkippedEntity(const CString &strName);

Receives notification of a skipped entity.

Parameters:
strName - the name of the skipped entity

Unicorn XML Toolkit
Version 1.00.00


This document was created using Unicorn DOC++.

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