Unicorn XML Toolkit
Version 1.00.00

Namespace Xslt
Class COutputHandler

class COutputHandler: public CInterface {
public:
    enum {
        disableOutputEscaping = 0x01
        };
public:
    COutputHandler();
    virtual ~COutputHandler();
public:
    virtual void SetOptions(
        const XOutputOptions &pOutputOptions) = 0;
    virtual void StartDocument() = 0;
    virtual void EndDocument() = 0;
    virtual void StartElement(
        const CString &strName,
        const CString &strNamespaceUri) = 0;
    virtual void EndElement() = 0;
    virtual void StartAttribute(
        const CString &strName,
        const CString &strNamespaceUri) = 0;
    virtual void EndAttribute() = 0;
    virtual void StartNamespace(const CString &strName) = 0;
    virtual void EndNamespace() = 0;
    virtual void CharacterData(
        const WCHAR *pData, int nSize, int nOptions=0) = 0;
    virtual void StartComment() = 0;
    virtual void EndComment() = 0;
    virtual void StartCdataSection() = 0;
    virtual void EndCdataSection() = 0;
    virtual void EntityReference(const CString &strName) = 0;
    virtual void ProcessingInstruction(
        const CString &strTarget, const CString &strData) = 0;
    };

The abstract interface to the XSLT output engine.

The output engine receives the result document (or the result tree fragment) represented as a stream of events. The COutputHandler class provides the set of event processing functions; the XSLT engine calls these functions in order to pass events to the output engine. The format of events is very similar to that supported by SXP (Simple XSL Parser API, see Sxp namespace for details); the main difference is that events StartElement and StartAttribute supply the namespace URI as an additional parameter, and all namespace declarations are reported using the separate pair of events StartNamespace and EndNamespace .

At least one derived class must be supplied to provide implementation of this interface. The default implementation is provided via the CBasicOutputHandler class, which implements all standard XSLT output methods.

Since:
1.00.00
Version:
1.00.00
Author:
Alexey Gokhberg
See Also:
COutputOptions
Constructor/Destructor Summary
COutputHandler ();
����������Constructs the output handler.
~COutputHandler ();
����������Destroys the 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.

Constructor/Destructor Detail

COutputHandler

COutputHandler();

Constructs the output handler.

~COutputHandler

virtual ~COutputHandler();

Destroys the output handler.

Function Detail

SetOptions

virtual void SetOptions(
    const XOutputOptions &pOutputOptions) = 0;

Sets output options for this output handler.

Parameters:
pOutputOptions - the output options

StartDocument

virtual void StartDocument() = 0;

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

virtual void EndDocument() = 0;

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

virtual void StartElement(
    const CString &strName,
    const CString &strNamespaceUri) = 0;

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

virtual void EndElement() = 0;

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

virtual void StartAttribute(
    const CString &strName,
    const CString &strNamespaceUri) = 0;

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

virtual void EndAttribute() = 0;

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

virtual void StartNamespace(const CString &strName) = 0;

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.

Parameters:
strName - the namespace prefix

EndNamespace

virtual void EndNamespace() = 0;

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

virtual void CharacterData(
    const WCHAR *pData, int nSize, int nOptions=0) = 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

virtual void StartComment() = 0;

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

virtual void EndComment() = 0;

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

virtual void StartCdataSection() = 0;

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

virtual void EndCdataSection() = 0;

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

virtual void EntityReference(const CString &strName) = 0;

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

virtual void ProcessingInstruction(
    const CString &strTarget, const CString &strData) = 0;

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

Unicorn XML Toolkit
Version 1.00.00


This document was created using Unicorn DOC++.

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