Unicorn XML Toolkit
Version 1.50.00

Namespace Xml
Class CToolkitBase

class CToolkitBase: public CInterface {
public:
    CToolkitBase();
    ~CToolkitBase();
public:
    CXmlBase *GetXmlBase();
    CDomBase *GetDomBase();
    CXpathBase *GetXpathBase();
    CXsltBase *GetXsltBase();
public:
    Sax::XXmlReader CreateXmlReader();
    XXmlWriter CreateXmlWriter();
public:
    Dom::XDocument CreateDomDocument(const WCHAR *pszClass=_W(""));
    XDomReader CreateDomReader(Dom::INode *pNode=NULL);
    XDomWriter CreateDomWriter(Dom::INode *pNode=NULL);
public:
    XXpathExpr CreateXpathExpr(const WCHAR *pszSource);
    XXpathContext CreateXpathContext(CXpathNodeSet *pNodeSet);
    XXpathContext CreateXpathContext(
        Dom::INode *pNode,
        int nCount=1,
        int nPosition=1);
public:
    XXsltStylesheet CreateXsltStylesheet(const WCHAR *pszUri);
    XXsltStylesheet CreateXsltStylesheet(
        const WCHAR *pszUri, Dom::INode *pNode);
    XXsltStylesheet CreateXsltStylesheet(
        const WCHAR *pszUri, Sax::CXmlReader *pReader);
    XXsltProcessor CreateXsltProcessor();
public:
    void SetErrorStream(IUnicodeStream *pErrorStream);
    IUnicodeStream *GetErrorStream();
    };
typedef XInterface<CToolkitBase> XToolkitBase;

Encapsulates core toolkit functionality.

This class provides the root for data structures supporting core toolkit object classes, which include:

The toolkit base provides various helper functions, designed for the programmer convenience.

Several other public methods of this class are intended mainly for the internal toolkit use and are not discussed here.

Various toolkit extensions normally rely in these core classes and therefore also use the toolkit base class.

Since:
1.50.00
Version:
1.50.00
Author:
Alexey Gokhberg
See Also:
CToolkitBase, CXmlBase, CDomBase, CXpathBase, CXsltBase, CXmlWriter, CDomReader, CDomWriter, CXpathNodeSet, CXpathContext, CXpathExpr, CXsltStylesheet, CXsltProcessor, CXsltStylesheet, CXsltProcessor, Sax::CXmlReader, Dom::INode, Dom::IDocument
Constructor/Destructor Summary
CToolkitBase ();
����������Constructs the toolkit base.
~CToolkitBase ();
����������Destroys the toolkit base.

Function Summary
CXmlBase�* GetXmlBase ();
����������Returns the toolkit XML base.
CDomBase�* GetDomBase ();
����������Returns the toolkit DOM base.
CXpathBase�* GetXpathBase ();
����������Returns the toolkit XPath base.
CXsltBase�* GetXsltBase ();
����������Returns the toolkit XSLT base.
Sax::XXmlReader CreateXmlReader ();
����������Creates an XML parser.
XXmlWriter CreateXmlWriter ();
����������Creates a new XML writer.
Dom::XDocument CreateDomDocument (const WCHAR *pszClass=_W(""));
����������Creates a new DOM/XDM document.
XDomReader CreateDomReader (Dom::INode *pNode=NULL);
����������Creates a new DOM reader.
XDomWriter CreateDomWriter (Dom::INode *pNode=NULL);
����������Creates a new DOM writer.
XXpathExpr CreateXpathExpr (const WCHAR *pszSource);
����������Creates the XPath expression.
XXpathContext CreateXpathContext (CXpathNodeSet *pNodeSet);
����������Creates the XPath context from the XPath node set.
XXpathContext CreateXpathContext (Dom::INode *pNode, int nCount=1, int nPosition=1);
����������Creates the XPath context from the context node, context size, and context position.
XXsltStylesheet CreateXsltStylesheet (const WCHAR *pszUri);
����������Creates the precompiled XSLT stylesheet from an XML document located via URI.
XXsltStylesheet CreateXsltStylesheet (const WCHAR *pszUri, Dom::INode *pNode);
����������Creates the precompiled XSLT stylesheet from an XML fragment rooted at the specified DOM/XDM node.
XXsltStylesheet CreateXsltStylesheet (const WCHAR *pszUri, Sax::CXmlReader *pReader);
����������Creates the precompiled XSLT stylesheet from a content stream provided by the specified SAX XML reader.
XXsltProcessor CreateXsltProcessor ();
����������Creates the new XSLT processor.
void SetErrorStream (IUnicodeStream *pErrorStream);
����������Sets a Unicode text stream for reporting non-fatal errors.
IUnicodeStream�* GetErrorStream ();
����������Returns the error stream.

Constructor/Destructor Detail

CToolkitBase

CToolkitBase();

Constructs the toolkit base.

~CToolkitBase

~CToolkitBase();

Destroys the toolkit base.

Function Detail

GetXmlBase

CXmlBase *GetXmlBase();

Returns the toolkit XML base.

Returns:
the toolkit XML base

GetDomBase

CDomBase *GetDomBase();

Returns the toolkit DOM base.

Returns:
the toolkit DOM base

GetXpathBase

CXpathBase *GetXpathBase();

Returns the toolkit XPath base.

Returns:
the toolkit XPath base

GetXsltBase

CXsltBase *GetXsltBase();

Returns the toolkit XSLT base.

Returns:
the toolkit XSLT base

CreateXmlReader

Sax::XXmlReader CreateXmlReader();

Creates an XML parser.

This function creates a new instance of the standard toolkit's non-validating XML parser, implementing interface of the abstract class Sax::CXmlReader .

Returns:
the newly created XML parser

CreateXmlWriter

XXmlWriter CreateXmlWriter();

Creates a new XML writer.

Returns:
the newly created XML writer

CreateDomDocument

Dom::XDocument CreateDomDocument(const WCHAR *pszClass=_W(""));

Creates a new DOM/XDM document.

The document class must be specified to indicate the document model. Supported values are "DOM" for DOM and "XPath" for XDM. The default (empty) value indicates DOM.

The newly created document has initially empty content.

Parameters:
pszClass - the class specifying the document model
Returns:
the newly created document

CreateDomReader

XDomReader CreateDomReader(Dom::INode *pNode=NULL);

Creates a new DOM reader.

Parameters:
pNode - the optional root of the sub-tree in the DOM document serving as the source for this DOM reader. If this parameter is set to NULL , the node must be specified using the SetNode method before starting the DOM reader.
Returns:
the newly created DOM reader

CreateDomWriter

XDomWriter CreateDomWriter(Dom::INode *pNode=NULL);

Creates a new DOM writer.

Parameters:
pNode - the node serving as the parent for a sub-tree, which the DOM writer should build. If this parameter is set to NULL , the node must be specified using the SetNode method before starting the source stream of SAX content events.
Returns:
the newly created DOM writer

CreateXpathExpr

XXpathExpr CreateXpathExpr(const WCHAR *pszSource);

Creates the XPath expression.

This method takes the string representation of the XPath expression, parses it, and stores result in the newly created CXpathExpr object.

It is an error is the expression contains references to functions not from the XPath core function library, or to variables.

Parameters:
pszSource - the string representation of the XPath expression
Returns:
the newly created expression object containing the compiled XPath expression

CreateXpathContext

XXpathContext CreateXpathContext(CXpathNodeSet *pNodeSet);

Creates the XPath context from the XPath node set.

See CXpathContext for details of node set construction.

Parameters:
pNodeSet - the XPath node set
Returns:
the newly created XPath context

CreateXpathContext

XXpathContext CreateXpathContext(
    Dom::INode *pNode,
    int nCount=1,
    int nPosition=1);

Creates the XPath context from the context node, context size, and context position.

The model of the context node must be XDM (that is, DOM nodes are not allowed).

See CXpathContext for details of node set construction.

Parameters:
pNode - the context node
nCount - the context size
nPosition - the context position
Returns:
the newly created XPath context

CreateXsltStylesheet

XXsltStylesheet CreateXsltStylesheet(const WCHAR *pszUri);

Creates the precompiled XSLT stylesheet from an XML document located via URI.

See Uri for details of the URI support.

Parameters:
pszUri - the source URI
Returns:
the newly created precompiled stylesheet

CreateXsltStylesheet

XXsltStylesheet CreateXsltStylesheet(
    const WCHAR *pszUri, Dom::INode *pNode);

Creates the precompiled XSLT stylesheet from an XML fragment rooted at the specified DOM/XDM node.

The source URI passed to the method is used solely for resolving relative URI encountered in during the stylesheet parsing; this parameter may be set to the empty string if the stylesheet contains no relative URI, which need to be resolved.

The node passed to the method may be of DOM or XDM model; it must be either a document node or an element node corresponding to the stylesheet root element.

Parameters:
pszUri - the source URI
pNode - the root of the sub-tree representing the stylesheet source
Returns:
the newly created precompiled stylesheet

CreateXsltStylesheet

XXsltStylesheet CreateXsltStylesheet(
    const WCHAR *pszUri, Sax::CXmlReader *pReader);

Creates the precompiled XSLT stylesheet from a content stream provided by the specified SAX XML reader.

The source URI passed to the method is used solely for resolving relative URI encountered in during the stylesheet parsing; this parameter may be set to the empty string if the stylesheet contains no relative URI, which need to be resolved.

Parameters:
pszUri - the source URI
pReader - the SAX XML reader providing the SAX content stream representing the stylesheet source

CreateXsltProcessor

XXsltProcessor CreateXsltProcessor();

Creates the new XSLT processor.

Returns:
the newly created XSLT processor

SetErrorStream

void SetErrorStream(IUnicodeStream *pErrorStream);

Sets a Unicode text stream for reporting non-fatal errors.

Parameters:
pErrorStream - the error stream

GetErrorStream

IUnicodeStream *GetErrorStream();

Returns the error stream.

Returns:
the error stream, of NULL if none was specified

Unicorn XML Toolkit
Version 1.50.00


This document was created using Unicorn DOC++.

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