Unicorn XML Toolkit
Version 1.00.00

Namespace FoHtml
Class IFormatter

class IFormatter: public CInterface {
public:
    IFormatter();
    virtual ~IFormatter();
public:
    virtual void SetOutputHandler(
        IOutputHandler *pOutputHandler) = 0;
    virtual void SetErrorHandler(
        IErrorHandler *pErrorHandler) = 0;
public:
    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) = 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 HTML-based UFO front-end (formatter).

The formatter receives the source document represented as a stream of events. The IFormatter class provides the set of event processing functions; the application which generates the source document must call these functions in order to pass events to the front-end. The format of events is very similar to that supported by SXP (Simple XML 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 (these features were introduced in order to simplify interfacing between the toolkit's XSLT engine and this front-end).

It is expected, that the source document is represented using the XSL FO vocabulary. The formatter generates HTML code as the sequence of output events. The generated events are passed to the instance of IOutputHandler associated with this formatter.

The error handler represented by an instance of IErrorHandler class can be specified to receive notifications of errors and warnings which might occur while the formatter is running.

Since:
1.00.00
Version:
1.00.00
Author:
Alexey Gokhberg
See Also:
IOutputHandler, IErrorHandler
Constructor/Destructor Summary
IFormatter ();
����������Constructs the formatter.
~IFormatter ();
����������Destroys the formatter.

Function Summary
void SetOutputHandler (IOutputHandler *pOutputHandler);
����������Specifies the output handler for receiving content or the result HTML document generated by this formatter.
void SetErrorHandler (IErrorHandler *pErrorHandler);
����������Specifies the error handler for receiving notifications of errors and warnings.
void StartDocument ();
����������Receives notification of the beginning of a document.
void EndDocument ();
����������Receives notification of the end of a document.
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);
����������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

IFormatter

IFormatter();

Constructs the formatter.

~IFormatter

virtual ~IFormatter();

Destroys the formatter.

Function Detail

SetOutputHandler

virtual void SetOutputHandler(
    IOutputHandler *pOutputHandler) = 0;

Specifies the output handler for receiving content or the result HTML document generated by this formatter.

Parameters:
pOutputHandler - the output handler

SetErrorHandler

virtual void SetErrorHandler(IErrorHandler *pErrorHandler) = 0;

Specifies the error handler for receiving notifications of errors and warnings.

Parameters:
pErrorHandler - the error handler

StartDocument

virtual void StartDocument() = 0;

Receives notification of the beginning of a document.

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

EndDocument

virtual void EndDocument() = 0;

Receives notification of the end of a document.

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

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 source 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 source 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 source 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 source 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 source 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) = 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.

Parameters:
pData - the array of characters
nSize - the number of characters to read from the array

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 source 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 source 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 source 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.

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 source document; there will be a corresponding StartCdataSection event for every EndCdataSection event.

EntityReference

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

Receives notification of an entity reference.

This function is invoked for each entity skipped.

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 source 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.