Unicorn XML Toolkit
Version 1.00.00

Namespace Sax
Class CXmlFilterImpl

class CXmlFilterImpl: 
        virtual public CXmlFilter,
        virtual public CEntityResolver,
        virtual public CDtdHandler,
        virtual public CContentHandler,
        virtual public CErrorHandler {
public:
    CXmlFilterImpl();
    CXmlFilterImpl(const XXmlReader &pParent);
    ~CXmlFilterImpl();
public:
    void SetParent(const XXmlReader &pParent);
    XXmlReader GetParent();
public:
    void SetFeature(const CString &strName, bool bValue);
    bool GetFeature(const CString &strName);
    void SetProperty(
        const CString &strName, 
        CInterface *pValue);
    CInterface *GetProperty(const CString &strName);
    void SetEntityResolver(const XEntityResolver &pResolver);
    XEntityResolver GetEntityResolver();
    void SetDtdHandler(const XDtdHandler &pHandler);
    XDtdHandler GetDtdHandler();
    void SetContentHandler(const XContentHandler &pHandler);
    XContentHandler GetContentHandler();
    void SetErrorHandler(const XErrorHandler &pHandler);
    XErrorHandler GetErrorHandler();
    void Parse(const XInputSource &pInput);
    void Parse(const CString &strSystemId);
    bool GetNamespaces();
    void SetInputSource(const XInputSource &pInput);
    XInputSource GetInputSource();
    void Start();
public:
    XInputSource ResolveEntity(
        const CString &strPublicId,
        const CString &strSystemId);
public:
    void NotationDecl(
        const CString &strName,
        const CString &strPublicId,
        const CString &strSystemId);
    void UnparsedEntityDecl(
        const CString &strName,
        const CString &strPublicId,
        const CString &strSystemId,
        const CString &strNotationName);
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);
public:
    void Warning(CSaxParseException *pException);
    void Error(CSaxParseException *pException);
    void FatalError(CSaxParseException *pException);
    };

The base class for deriving XML filters.

This class is designed to sit between an CXmlReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.

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, CDtdHandler, CEntityResolver, CErrorHandler, CInputSource, CLocator, CSaxParseException, CXmlReader
Constructor/Destructor Summary
CXmlFilterImpl ();
����������Constructs the empty XML filter, with no parent.
CXmlFilterImpl (const XXmlReader &pParent);
����������Constructs the XML filter with the specified parent.
~CXmlFilterImpl ();
����������Destroys the XML filter.

Function Summary
void SetParent (const XXmlReader &pParent);
����������Sets the parent reader.
XXmlReader GetParent ();
����������Gets the parent reader.
void SetFeature (const CString &strName, bool bValue);
����������Sets the state of a feature.
bool GetFeature (const CString &strName);
����������Looks up the state of a feature.
void SetProperty (const CString &strName, CInterface *pValue);
����������Sets the value of a property.
CInterface�* GetProperty (const CString &strName);
����������Looks up the value of a property.
void SetEntityResolver (const XEntityResolver &pResolver);
����������Sets the entity resolver.
XEntityResolver GetEntityResolver ();
����������Gets the current entity resolver.
void SetDtdHandler (const XDtdHandler &pHandler);
����������Sets the DTD event handler.
XDtdHandler GetDtdHandler ();
����������Gets the current DTD event handler.
void SetContentHandler (const XContentHandler &pHandler);
����������Sets the content event handler.
XContentHandler GetContentHandler ();
����������Gets the content event handler.
void SetErrorHandler (const XErrorHandler &pHandler);
����������Sets the error event handler.
XErrorHandler GetErrorHandler ();
����������Gets the current error event handler.
void Parse (const XInputSource &pInput);
����������Parses a docment.
void Parse (const CString &strSystemId);
����������Parses a document.
bool GetNamespaces ();
����������Tests whether content events generated by this filter provide namespace information.
void SetInputSource (const XInputSource &pInput);
����������Sets the input source.
XInputSource GetInputSource ();
����������Gets the current input source.
void Start ();
����������Starts the XML stream implemented by this filter.
XInputSource ResolveEntity (const CString &strPublicId, const CString &strSystemId);
����������Filters an external entity resolution.
void NotationDecl (const CString &strName, const CString &strPublicId, const CString &strSystemId);
����������Filters a notation declaration event.
void UnparsedEntityDecl (const CString &strName, const CString &strPublicId, const CString &strSystemId, const CString &strNotationName);
����������Filters an unparsed entity declaration event.
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.
void Warning (CSaxParseException *pException);
����������Filters a warning event.
void Error (CSaxParseException *pException);
����������Filters an error event.
void FatalError (CSaxParseException *pException);
����������Filters a fatal error event.

Constructor/Destructor Detail

CXmlFilterImpl

CXmlFilterImpl();

Constructs the empty XML filter, with no parent.

This filter will have no parent: you must assign a parent before you start a parse or do any configuration with SetFeature or SetProperty .

CXmlFilterImpl

CXmlFilterImpl(const XXmlReader &pParent);

Constructs the XML filter with the specified parent.

Parameters:
pParent - the parent XML reader

~CXmlFilterImpl

~CXmlFilterImpl();

Destroys the XML filter.

Function Detail

SetParent

void SetParent(const XXmlReader &pParent);

Sets the parent reader.

This is the XML reader from which this filter will obtain its events and to which it will pass its configuration requests. The parent may itself be another filter.

If there is no parent reader set, any attempt to parse or to set or get a feature or property will fail.

Parameters:
pParent - the parent XML reader

GetParent

XXmlReader GetParent();

Gets the parent reader.

Returns:
the the parent XML reader, or NULL if none is set

SetFeature

void SetFeature(const CString &strName, bool bValue);

Sets the state of a feature.

This will always fail if the parent is NULL .

Parameters:
strName - the feature name
bValue - the requested feature state

GetFeature

bool GetFeature(const CString &strName);

Looks up the state of a feature.

This will always fail if the parent is NULL .

Parameters:
strName - the feature name
Returns:
the current state of the feature

SetProperty

void SetProperty(
    const CString &strName, 
    CInterface *pValue);

Sets the value of a property.

This will always fail if the parent is NULL .

Parameters:
strName - the property name
pValue - the requested property value

GetProperty

CInterface *GetProperty(const CString &strName);

Looks up the value of a property.

Parameters:
strName - the property name
Returns:
the current value of the property

SetEntityResolver

void SetEntityResolver(const XEntityResolver &pResolver);

Sets the entity resolver.

Parameters:
pResolver - the new entity resolver

GetEntityResolver

XEntityResolver GetEntityResolver();

Gets the current entity resolver.

Returns:
the current entity resolver, or NULL if none was set

SetDtdHandler

void SetDtdHandler(const XDtdHandler &pHandler);

Sets the DTD event handler.

Parameters:
pHandler - the new DTD handler

GetDtdHandler

XDtdHandler GetDtdHandler();

Gets the current DTD event handler.

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

SetContentHandler

void SetContentHandler(const XContentHandler &pHandler);

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

SetErrorHandler

void SetErrorHandler(const XErrorHandler &pHandler);

Sets the error event handler.

Parameters:
pHandler - the new error handler

GetErrorHandler

XErrorHandler GetErrorHandler();

Gets the current error event handler.

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

Parse

void Parse(const XInputSource &pInput);

Parses a docment.

Parameters:
pInput - the input source for the document entity

Parse

void Parse(const CString &strSystemId);

Parses a document.

Parameters:
strSystemId - the system identifier as a fully-qualified URI

GetNamespaces

bool GetNamespaces();

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

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

SetInputSource

void SetInputSource(const XInputSource &pInput);

Sets the input source.

This method is useful when the XML stream implemented by this filter is started using the CXmlStream::Start method.

Parameters:
pInput - the input source

GetInputSource

XInputSource GetInputSource();

Gets the current input source.

Returns:
the current input source, or NULL if none has been registered

Start

void Start();

Starts the XML stream implemented by this filter.

ResolveEntity

XInputSource ResolveEntity(
    const CString &strPublicId,
    const CString &strSystemId);

Filters an external entity resolution.

Parameters:
strPublicId - the entity's public identifier, or the empty string
strSystemId - the entity's system identifier

NotationDecl

void NotationDecl(
    const CString &strName,
    const CString &strPublicId,
    const CString &strSystemId);

Filters a notation declaration event.

Parameters:
strName - the notation name
strPublicId - the notation's public identifier, or the empty string
strSystemId - the notation's system identifier, or the empty string

UnparsedEntityDecl

void UnparsedEntityDecl(
    const CString &strName,
    const CString &strPublicId,
    const CString &strSystemId,
    const CString &strNotationName);

Filters an unparsed entity declaration event.

Parameters:
strName - the entity name
strPublicId - the entity's public identifier, or the empty string
strSystemId - the entity's system identifier, or the empty stringt
strNotationName - the name of the associated notation

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

Warning

void Warning(CSaxParseException *pException);

Filters a warning event.

Parameters:
pException - the exception representing the warning

Error

void Error(CSaxParseException *pException);

Filters an error event.

Parameters:
pException - the exception representing the error

FatalError

void FatalError(CSaxParseException *pException);

Filters a fatal error event.

Parameters:
pException - the exception representing the error

Unicorn XML Toolkit
Version 1.00.00


This document was created using Unicorn DOC++.

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