Unicorn XML Toolkit
Version 1.00.00

Namespace Xslt
Class CBasicOutputHandler

class CBasicOutputHandler: public COutputHandler {
public:
    CBasicOutputHandler();
    ~CBasicOutputHandler();
public:
    void SetOptions(const XOutputOptions &pOutputOptions);
    void StartDocument();
    void EndDocument();
    void StartElement(
        const CString &strName,
        const CString &strNamespaceUri);
    void EndElement();
    void StartAttribute(
        const CString &strName,
        const CString &strNamespaceUri);
    void EndAttribute();
    void StartNamespace(const CString &strName);
    void EndNamespace();
    void CharacterData(
        const WCHAR *pData, int nSize, int nOptions=0);
    void StartComment();
    void EndComment();
    void StartCdataSection();
    void EndCdataSection();
    void EntityReference(const CString &strName);
    void ProcessingInstruction(
        const CString &strTarget, const CString &strData);
public:
    void SetEncodingHandler(
        const XEncodingHandler &pEncodingHandler);
    void SetStream(IStream *pStream);
    void SetXmlOutputHandler(const XOutputHandler &pOutputHandler);
    void SetHtmlOutputHandler(const XOutputHandler &pOutputHandler);
    void SetTextOutputHandler(const XOutputHandler &pOutputHandler);
    void AddExtensionOutputHandler(
        const CString &strNamespaceUri,
        const CString &strLocalName,
        const XOutputHandler &pOutputHandler);
    XOutputHandler GetXmlOutputHandler();
    XOutputHandler GetHtmlOutputHandler();
    XOutputHandler GetTextOutputHandler();
    };

The default implementation of the output handler.

It supports all standard XSLT output methods.

The basic output handler encapsulates the list of output handlers implementing various standard and extension output methods.

See COutputHandler for general discussion of output handlers.

Since:
1.00.00
Version:
1.00.00
Author:
Alexey Gokhberg
See Also:
CEncodingHandler, COutputOptions, COutputHandler
Constructor/Destructor Summary
CBasicOutputHandler ();
����������Constructs the basic output handler.
~CBasicOutputHandler ();
����������Destroys the basic output handler.

Function Summary
void SetOptions (const XOutputOptions &pOutputOptions);
����������Sets output options for this output handler.
void StartDocument ();
����������Receives notification of the beginning of a document or a result tree fragment.
void EndDocument ();
����������Receives notification of the end of a document or a result tree fragment.
void StartElement (const CString &strName, const CString &strNamespaceUri);
����������Receives notification of the beginning of an element.
void EndElement ();
����������Receives notification of the end of an element.
void StartAttribute (const CString &strName, const CString &strNamespaceUri);
����������Receives notification of the beginning of an attribute.
void EndAttribute ();
����������Receives notification of the end of an attribute.
void StartNamespace (const CString &strName);
����������Receives notification of the beginning of a namespace declaration.
void EndNamespace ();
����������Receives notification of the end of a namespace declaration.
void CharacterData (const WCHAR *pData, int nSize, int nOptions=0);
����������Receives notification of character data.
void StartComment ();
����������Receives notification of the beginning of a comment.
void EndComment ();
����������Receives notification of the end of a comment.
void StartCdataSection ();
����������Receives notification of the beginning of a CDATA section.
void EndCdataSection ();
����������Receives notification of the end of a CDATA section.
void EntityReference (const CString &strName);
����������Receives notification of an entity reference.
void ProcessingInstruction (const CString &strTarget, const CString &strData);
����������Receives notification of a processing instruction.
void SetEncodingHandler (const XEncodingHandler &pEncodingHandler);
����������Sets the encoding handler.
void SetStream (IStream *pStream);
����������Sets the stream to output the result.
void SetXmlOutputHandler (const XOutputHandler &pOutputHandler);
����������Sets the custom XML output handler.
void SetHtmlOutputHandler (const XOutputHandler &pOutputHandler);
����������Sets the custom HTML output handler.
void SetTextOutputHandler (const XOutputHandler &pOutputHandler);
����������Sets the custom text output handler.
void AddExtensionOutputHandler (const CString &strNamespaceUri, const CString &strLocalName, const XOutputHandler &pOutputHandler);
����������Adds the output handler for the given extension output method to the list of output handlers supported by the basic output handler.
XOutputHandler GetXmlOutputHandler ();
����������Returns the XML output handler provided by this basic output handler.
XOutputHandler GetHtmlOutputHandler ();
����������Returns the HTML output handler provided by this basic output handler.
XOutputHandler GetTextOutputHandler ();
����������Returns the text output handler provided by this basic output handler.

Constructor/Destructor Detail

CBasicOutputHandler

CBasicOutputHandler();

Constructs the basic output handler.

~CBasicOutputHandler

~CBasicOutputHandler();

Destroys the basic output handler.

Function Detail

SetOptions

void SetOptions(
    const XOutputOptions &pOutputOptions);

Sets output options for this output handler.

Parameters:
pOutputOptions - the output options

StartDocument

void StartDocument();

Receives notification of the beginning of a document or a result tree fragment.

This function is invoked only once per document, before any other event processing functions in this class.

This function is invoked even if the event stream represents a result tree fragment rather than a document.

EndDocument

void EndDocument();

Receives notification of the end of a document or a result tree fragment.

This function is invoked only once per document, after any other event processing functions in this class.

This function is invoked even if the event stream represents a result tree fragment rather than a document.

StartElement

void StartElement(
    const CString &strName,
    const CString &strNamespaceUri);

Receives notification of the beginning of an element.

Both qualified name and namespace URI must be specified. The specified namespace URI (even if empty) is mandatory; it supersedes the namespace implicitly defined by the prefix of the specified qualified name.

This function is invoked at the beginning of every element in the result document; there will be a corresponding EndElement event for every StartElement event (even when the element is empty). All of the namespaces in the scope on the element, followed by all of the element's attributes, followed by all of the element's content will be reported, in order, before the coresponding EndElement event.

Parameters:
strName - the qualified (prefixed) name
strNamespaceUri - the namespace URI; the empty string if the element has no namespace URI

EndElement

void EndElement();

Receives notification of the end of an element.

This function is invoked at the end of every element in the result document; there will be a corresponding StartElement event for every EndElement event (even when the element is empty).

StartAttribute

void StartAttribute(
    const CString &strName,
    const CString &strNamespaceUri);

Receives notification of the beginning of an attribute.

Both qualified name and namespace URI must be specified. The specified namespace URI (even if empty) is mandatory; it supersedes the namespace implicitly defined by the prefix of the specified qualified name.

This function is invoked at the beginning of every attribute declaration in the result document; there will be a corresponding EndAttribute event for every StartAttribute event. The attribute value will be reported as one or more CharacterData events, before the coresponding EndAttribute event.

This function is never invoked to report attributes corresponding to namespace declarations (that is, having names started with "xmlns" ).

Parameters:
strName - the qualified (prefixed) name
strNamespaceUri - the namespace URI; the empty string if the element has no namespace URI

EndAttribute

void EndAttribute();

Receives notification of the end of an attribute.

This function is invoked at the end of every attribute declaration in the result document; there will be a corresponding StartAttribute event for every EndAttribute event.

StartNamespace

void StartNamespace(const CString &strName);

Receives notification of the beginning of a namespace declaration.

Notifications must be generated for all namespace declarations in scope on every element in the result document (even for namespaces that are actually declared on the element's ancestor).

This function is invoked at the beginning of every namespace declaration; there will be a corresponding EndNamespace event for every StartNamespace event. The namespace URI will be reported as one or more CharacterData events, before the coresponding EndNamespace event.

EndNamespace

void EndNamespace();

Receives notification of the end of a namespace declaration.

This function is invoked at the end of every namespace declaration; there will be a corresponding StartNamespace event for every EndNamespace event.

CharacterData

void CharacterData(
    const WCHAR *pData, int nSize, int nOptions=0);

Receives notification of character data.

This function is invoked to report each chunk of character data, each chunk of the content of every comment, each chunk of every attribute value, and each chunk of the namespace URI in every namespace declaration.

Applications may supply all contiguous character data in a single chunk, or they may split it into several chunks.

The output options are represented by the set of bit flags. The only allowed bit flag is COutputHandler::disableOutputEscaping .

Parameters:
pData - the array of characters
nSize - the number of characters to read from the array
nOptions - the set of bit flags indicating output options

StartComment

void StartComment();

Receives notification of the beginning of a comment.

This function is invoked at the beginning of every comment in the result document; there will be a corresponding EndComment event for every StartComment event. The contents of the comment will be reported as one or more CharacterData events, before the coresponding EndComment event.

EndComment

void EndComment();

Receives notification of the end of a comment.

This function is invoked at the end of every comment in the result document; there will be a corresponding StartComment event for every EndComment event.

StartCdataSection

void StartCdataSection();

Receives notification of the beginning of a CDATA section.

This function is invoked at the beginning of every CDATA section in the result document; there will be a corresponding EndCdataSection event for every StartCdataSection event. The contents of the CDATA section will be reported as one or more CharacterData events, before the coresponding EndCdataSection event.

In the current release of the toolkit, this function is never called by the XSLT engine. It is reserved for the future.

EndCdataSection

void EndCdataSection();

Receives notification of the end of a CDATA section.

This function is invoked at the end of every CDATA section in the result document; there will be a corresponding StartCdataSection event for every EndCdataSection event.

In the current release of the toolkit, this function is never called by the XSLT engine. It is reserved for the future.

EntityReference

void EntityReference(const CString &strName);

Receives notification of an entity reference.

This function is invoked for each entity skipped.

In the current release of the toolkit, this function is never called by the XSLT engine. It is reserved for the future.

Parameters:
strName - the entity name

ProcessingInstruction

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

Receives notification of a processing instruction.

This function is invoked once for each processing instruction in the result document.

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

SetEncodingHandler

void SetEncodingHandler(
    const XEncodingHandler &pEncodingHandler);

Sets the encoding handler.

Parameters:
pEncodingHandler - the encoding handler

SetStream

void SetStream(IStream *pStream);

Sets the stream to output the result.

Parameters:
pStream - the stream to output the result

SetXmlOutputHandler

void SetXmlOutputHandler(const XOutputHandler &pOutputHandler);

Sets the custom XML output handler.

The custom XML output handler will replace the default XML output handler implemented by the basic output handler.

Parameters:
pOutputHandler - the custom XML output handler

SetHtmlOutputHandler

void SetHtmlOutputHandler(const XOutputHandler &pOutputHandler);

Sets the custom HTML output handler.

The custom HTML output handler will replace the default HTML output handler implemented by the basic output handler.

Parameters:
pOutputHandler - the custom HTML output handler

SetTextOutputHandler

void SetTextOutputHandler(const XOutputHandler &pOutputHandler);

Sets the custom text output handler.

The custom text output handler will replace the default text output handler implemented by the basic output handler.

Parameters:
pOutputHandler - the custom text output handler

AddExtensionOutputHandler

void AddExtensionOutputHandler(
    const CString &strNamespaceUri,
    const CString &strLocalName,
    const XOutputHandler &pOutputHandler);

Adds the output handler for the given extension output method to the list of output handlers supported by the basic output handler.

Parameters:
strNamespaceUri - the namespace URI of the extension output method
strLocalName - the local name of the extension output method
pOutputHandler - the output handler implementing the extension output method

GetXmlOutputHandler

XOutputHandler GetXmlOutputHandler();

Returns the XML output handler provided by this basic output handler.

Returns:
the XML output handler provided by this basic output handler

GetHtmlOutputHandler

XOutputHandler GetHtmlOutputHandler();

Returns the HTML output handler provided by this basic output handler.

Returns:
the HTML output handler provided by this basic output handler

GetTextOutputHandler

XOutputHandler GetTextOutputHandler();

Returns the text output handler provided by this basic output handler.

Returns:
the text output handler provided by this basic output handler

Unicorn XML Toolkit
Version 1.00.00


This document was created using Unicorn DOC++.

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