Unicorn XML Toolkit
Version 1.00.00

Namespace Sax
Class CXmlProcessor

class CXmlProcessor: 
        virtual public CXmlStream, 
        virtual public CContentHandler {
public:
    CXmlProcessor();
    ~CXmlProcessor();
public:
    void SetInputStream(const XXmlStream &pInputStream);
    XXmlStream GetInputStream();
public:
    bool GetNamespaces(void);
    void SetContentHandler(const XContentHandler &pContentHandler);
    XContentHandler GetContentHandler();
    void Start();
public:
    void SetDocumentLocator(const 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 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 abstract interface to XML processors.

An XML processor is like an XML stream, except that it obtains its content events from another (input) XML stream rather than a primary source like an XML document or database. Processors can modify a stream of content events as they pass on to the final application.

This class is the light-weight counterpart of CXmlFilter . Having no prototype in the original SAX2 specification, this class was introduced to provide the mean for integration of various XML processing components.

Since:
1.00.00
Version:
1.00.00
Author:
C++ interfaces by Alexey Gokhberg; based on the original SAX2 specification by David Megginson
See Also:
CAttributes, CContentHandler, CInputStream, CLocator
Constructor/Destructor Summary
CXmlProcessor ();
����������Constructs the XML processor.
~CXmlProcessor ();
����������Destroys the XML processor.

Function Summary
void SetInputStream (const XXmlStream &pInputStream);
����������Sets the input XML stream.
XXmlStream GetInputStream ();
����������Gets the input XML stream.
bool GetNamespaces (void);
����������Tests whether content events generated by this processor provide namespace information.
void SetContentHandler (const XContentHandler &pContentHandler);
����������Sets the content event handler.
XContentHandler GetContentHandler ();
����������Gets the content event handler.
void Start ();
����������Starts the XML stream implemented by this processor.
void SetDocumentLocator (const XLocator &pLocator);
����������Filters a new document locator event.
void StartDocument ();
����������Filters a start document event.
void EndDocument ();
����������Filters an end document event.
void StartPrefixMapping (const CString &strPrefix, const CString &strUri);
����������Filters a start namespace prefix mapping event.
void EndPrefixMapping (const CString &strPrefix);
����������Filters an end namespace prefix mapping event.
void StartElement (const CString &strUri, const CString &strLocalName, const CString &strQName, const XAttributes &pAtts);
����������Filters a start element event.
void EndElement (const CString &strUri, const CString &strLocalName, const CString &strQName);
����������Filters an end element event.
void Characters (const WCHAR *pCh, int nLength);
����������Filters a character data event.
void IgnorableWhitespace (const WCHAR *pCh, int nLength);
����������Filters an ignorable whitespace event.
void ProcessingInstruction (const CString &strTarget, const CString &strData);
����������Filters a processing instruction event.
void SkippedEntity (const CString &strName);
����������Filters a skipped entity event.

Constructor/Destructor Detail

CXmlProcessor

CXmlProcessor();

Constructs the XML processor.

~CXmlProcessor

~CXmlProcessor();

Destroys the XML processor.

Function Detail

SetInputStream

void SetInputStream(const XXmlStream &pInputStream);

Sets the input XML stream.

Parameters:
pInputStream - the input XML stream

GetInputStream

XXmlStream GetInputStream();

Gets the input XML stream.

Returns:
the input XML stream, or NULL if none is set

GetNamespaces

bool GetNamespaces(void);

Tests whether content events generated by this processor provide namespace information.

Returns:
true if content events generated by this processor provide namespace information; false otherwise

SetContentHandler

void SetContentHandler(const XContentHandler &pContentHandler);

Sets the content event handler.

Parameters:
pHandler - the new content handler

GetContentHandler

XContentHandler GetContentHandler();

Gets the content event handler.

Returns:
the current content handler, or NULL if none was set

Start

void Start();

Starts the XML stream implemented by this processor.

SetDocumentLocator

void SetDocumentLocator(const XLocator &pLocator);

Filters a new document locator event.

Parameters:
pLocator - the document locator

StartDocument

void StartDocument();

Filters a start document event.

EndDocument

void EndDocument();

Filters an end document event.

StartPrefixMapping

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

Filters a start namespace prefix mapping event.

Parameters:
strPrefix - the namespace prefix
strUri - the namespace URI

EndPrefixMapping

void EndPrefixMapping(const CString &strPrefix);

Filters an end namespace prefix mapping event.

Parameters:
strPrefix - the namespace prefix

StartElement

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

Filters a start element event.

Parameters:
strUri - the element's namespace URI, or the empty string
strLocalName - the element's local name, or the empty string
strQName - the element's qualified (prefixed) name, or the empty string
pAtts - the element's attributes

EndElement

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

Filters an end element event.

Parameters:
strUri - the element's namespace URI, or the empty string
strLocalName - the element's local name, or the empty string
strQName - the element's qualified (prefixed) name, or the empty string

Characters

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

Filters a character data event.

Parameters:
pCh - the array of characters
nLength - the number of characters to use from the array

IgnorableWhitespace

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

Filters an ignorable whitespace event.

Parameters:
pCh - the array of characters
nLength - the number of characters to use from the array

ProcessingInstruction

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

Filters a processing instruction event.

Parameters:
strTarget - the procession instruction target
strData - the processing instruction data

SkippedEntity

void SkippedEntity(const CString &strName);

Filters a skipped entity event.

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.