Unicorn XML Toolkit
Version 1.50.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(CXmlReader *pParent);
    ~CXmlFilterImpl();
public:
    void SetParent(const CXmlReader *pParent);
    CXmlReader *GetParent();
public:
    void SetFeature(const WCHAR *pszName, bool bValue);
    bool GetFeature(const WCHAR *pszName);
    void SetProperty(
        const WCHAR *pszName, 
        CInterface *pValue);
    CInterface *GetProperty(const WCHAR *pszName);
    void SetEntityResolver(CEntityResolver *pResolver);
    CEntityResolver *GetEntityResolver();
    void SetDtdHandler(CDtdHandler *pHandler);
    CDtdHandler *GetDtdHandler();
    void SetContentHandler(CContentHandler *pHandler);
    CContentHandler *GetContentHandler();
    void SetErrorHandler(CErrorHandler *pHandler);
    CErrorHandler *GetErrorHandler();
    void Parse(CInputSource *pInput);
    void Parse(const WCHAR *pszSystemId);
    void SetNamespaces(bool bNamespaces);
    bool GetNamespaces();
    void SetInputSource(CInputSource *pInput);
    CInputSource *GetInputSource();
    void Start();
public:
    XInputSource ResolveEntity(
        const WCHAR *pszPublicId,
        const WCHAR *pszSystemId);
public:
    void NotationDecl(
        const WCHAR *pszName,
        const WCHAR *pszPublicId,
        const WCHAR *pszSystemId);
    void UnparsedEntityDecl(
        const WCHAR *pszName,
        const WCHAR *pszPublicId,
        const WCHAR *pszSystemId,
        const WCHAR *pszNotationName);
public:
    void SetDocumentLocator(CLocator *pLocator);
    void StartDocument();
    void EndDocument();
    void StartPrefixMapping(
        const WCHAR *pszPrefix,
        const WCHAR *pszUri);
    void EndPrefixMapping(const WCHAR *pszPrefix);
    void StartElement(
        const WCHAR *pszUri,
        const WCHAR *pszLocalName,
        const WCHAR *pszQName,
        CAttributes *pAtts);
    void EndElement(
        const WCHAR *pszUri,
        const WCHAR *pszLocalName,
        const WCHAR *pszQName);
    void Characters(const WCHAR *pCh, int nLength);
    void IgnorableWhitespace(const WCHAR *pCh, int nLength);
    void ProcessingInstruction(
        const WCHAR *pszTarget,
        const WCHAR *pszData);
    void SkippedEntity(const WCHAR *pszName);
public:
    void Warning(CSaxParseException *pException);
    void Error(CSaxParseException *pException);
    void FatalError(CSaxParseException *pException);
    };
typedef XInterface<CXmlFilterImpl> XXmlFilterImpl;

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.50.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 (CXmlReader *pParent);
����������Constructs the XML filter with the specified parent.
~CXmlFilterImpl ();
����������Destroys the XML filter.

Function Summary
void SetParent (CXmlReader *pParent);
����������Sets the parent reader.
CXmlReader�* GetParent ();
����������Gets the parent reader.
void SetFeature (const WCHAR *pszName, bool bValue);
����������Sets the state of a feature.
bool GetFeature (const WCHAR *pszName);
����������Looks up the state of a feature.
void SetProperty (const WCHAR *pszName, CInterface *pValue);
����������Sets the value of a property.
CInterface�* GetProperty (const WCHAR *pszName);
����������Looks up the value of a property.
void SetEntityResolver (CEntityResolver *pResolver);
����������Sets the entity resolver.
CEntityResolver�* GetEntityResolver ();
����������Gets the current entity resolver.
void SetDtdHandler (CDtdHandler *pHandler);
����������Sets the DTD event handler.
CDtdHandler�* GetDtdHandler ();
����������Gets the current DTD event handler.
void SetContentHandler (CContentHandler *pHandler);
����������Sets the content event handler.
CContentHandler�* GetContentHandler ();
����������Gets the content event handler.
void SetErrorHandler (CErrorHandler *pHandler);
����������Sets the error event handler.
CErrorHandler�* GetErrorHandler ();
����������Gets the current error event handler.
void Parse (CInputSource *pInput);
����������Parses a docment.
void Parse (const WCHAR *pszSystemId);
����������Parses a document.
void SetNamespaces (bool bNamespaces);
����������Specifies whether content events generated by this filter must provide namespace information.
bool GetNamespaces ();
����������Tests whether content events generated by this filter provide namespace information.
void SetInputSource (CInputSource *pInput);
����������Sets the input source.
CInputSource�* GetInputSource ();
����������Gets the current input source.
void Start ();
����������Starts the XML reader implemented by this filter.
XInputSource ResolveEntity (const WCHAR *pszPublicId, const WCHAR *pszSystemId);
����������Filters an external entity resolution.
void NotationDecl (const WCHAR *pszName, const WCHAR *pszPublicId, const WCHAR *pszSystemId);
����������Filters a notation declaration event.
void UnparsedEntityDecl (const WCHAR *pszName, const WCHAR *pszPublicId, const WCHAR *pszSystemId, const WCHAR *pszNotationName);
����������Filters an unparsed entity declaration event.
void SetDocumentLocator (CLocator *pLocator);
����������Filters a new document locator event.
void StartDocument ();
����������Filters a start document event.
void EndDocument ();
����������Filters an end document event.
void StartPrefixMapping (const WCHAR *pszPrefix, const WCHAR *pszUri);
����������Filters a start namespace prefix mapping event.
void EndPrefixMapping (const WCHAR *pszPrefix);
����������Filters an end namespace prefix mapping event.
void StartElement (const WCHAR *pszUri, const WCHAR *pszLocalName, const WCHAR *pszQName, CAttributes *pAtts);
����������Filters a start element event.
void EndElement (const WCHAR *pszUri, const WCHAR *pszLocalName, const WCHAR *pszQName);
����������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 WCHAR *pszTarget, const WCHAR *pszData);
����������Filters a processing instruction event.
void SkippedEntity (const WCHAR *pszName);
����������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(CXmlReader *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(CXmlReader *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

CXmlReader *GetParent();

Gets the parent reader.

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

SetFeature

void SetFeature(const WCHAR *pszName, bool bValue);

Sets the state of a feature.

This will always fail if the parent is NULL .

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

GetFeature

bool GetFeature(const WCHAR *pszName);

Looks up the state of a feature.

This will always fail if the parent is NULL .

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

SetProperty

void SetProperty(
    const WCHAR *pszName, 
    CInterface *pValue);

Sets the value of a property.

This will always fail if the parent is NULL .

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

GetProperty

CInterface *GetProperty(const WCHAR *pszName);

Looks up the value of a property.

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

SetEntityResolver

void SetEntityResolver(CEntityResolver *pResolver);

Sets the entity resolver.

Parameters:
pResolver - the new entity resolver

GetEntityResolver

CEntityResolver *GetEntityResolver();

Gets the current entity resolver.

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

SetDtdHandler

void SetDtdHandler(CDtdHandler *pHandler);

Sets the DTD event handler.

Parameters:
pHandler - the new DTD handler

GetDtdHandler

CDtdHandler *GetDtdHandler();

Gets the current DTD event handler.

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

SetContentHandler

void SetContentHandler(CContentHandler *pHandler);

Sets the content event handler.

Parameters:
pHandler - the new content handler

GetContentHandler

CContentHandler *GetContentHandler();

Gets the content event handler.

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

SetErrorHandler

void SetErrorHandler(CErrorHandler *pHandler);

Sets the error event handler.

Parameters:
pHandler - the new error handler

GetErrorHandler

CErrorHandler *GetErrorHandler();

Gets the current error event handler.

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

Parse

void Parse(CInputSource *pInput);

Parses a docment.

Parameters:
pInput - the input source for the document entity

Parse

void Parse(const WCHAR *pszSystemId);

Parses a document.

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

SetNamespaces

void SetNamespaces(bool bNamespaces);

Specifies whether content events generated by this filter must provide namespace information.

Parameters:
bNamespaces - true if content events generated by this filter must provide namespace information; false otherwise

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(CInputSource *pInput);

Sets the input source.

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

Parameters:
pInput - the input source

GetInputSource

CInputSource *GetInputSource();

Gets the current input source.

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

Start

void Start();

Starts the XML reader implemented by this filter.

ResolveEntity

XInputSource ResolveEntity(
    const WCHAR *pszPublicId,
    const WCHAR *pszSystemId);

Filters an external entity resolution.

Parameters:
pszPublicId - the entity's public identifier, or the empty string
pszSystemId - the entity's system identifier

NotationDecl

void NotationDecl(
    const WCHAR *pszName,
    const WCHAR *pszPublicId,
    const WCHAR *pszSystemId);

Filters a notation declaration event.

Parameters:
pszName - the notation name
pszPublicId - the notation's public identifier, or the empty string
pszSystemId - the notation's system identifier, or the empty string

UnparsedEntityDecl

void UnparsedEntityDecl(
    const WCHAR *pszName,
    const WCHAR *pszPublicId,
    const WCHAR *pszSystemId,
    const WCHAR *pszNotationName);

Filters an unparsed entity declaration event.

Parameters:
pszName - the entity name
pszPublicId - the entity's public identifier, or the empty string
pszSystemId - the entity's system identifier, or the empty stringt
pszNotationName - the name of the associated notation

SetDocumentLocator

void SetDocumentLocator(CLocator *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 WCHAR *pszPrefix,
    const WCHAR *pszUri);

Filters a start namespace prefix mapping event.

Parameters:
pszPrefix - the namespace prefix
pszUri - the namespace URI

EndPrefixMapping

void EndPrefixMapping(const WCHAR *pszPrefix);

Filters an end namespace prefix mapping event.

Parameters:
pszPrefix - the namespace prefix

StartElement

void StartElement(
    const WCHAR *pszUri,
    const WCHAR *pszLocalName,
    const WCHAR *pszQName,
    CAttributes *pAtts);

Filters a start element event.

Parameters:
pszUri - the element's namespace URI, or the empty string
pszLocalName - the element's local name, or the empty string
pszQName - the element's qualified (prefixed) name, or the empty string
pAtts - the element's attributes

EndElement

void EndElement(
    const WCHAR *pszUri,
    const WCHAR *pszLocalName,
    const WCHAR *pszQName);

Filters an end element event.

Parameters:
pszUri - the element's namespace URI, or the empty string
pszLocalName - the element's local name, or the empty string
pszQName - 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 WCHAR *pszTarget,
    const WCHAR *pszData);

Filters a processing instruction event.

Parameters:
pszTarget - the procession instruction target
pszData - the processing instruction data

SkippedEntity

void SkippedEntity(const WCHAR *pszName);

Filters a skipped entity event.

Parameters:
pszName - 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.50.00


This document was created using Unicorn DOC++.

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