Unicorn XML Toolkit
Version 1.00.00

Namespace EcmaScriptXml
Class CXmlExtension

class CXmlExtension {
public:
    CXmlExtension(const XGlobalObject &pGlobalObject);
    ~CXmlExtension();
public:
    void Register(
        const CString &strPropertyName,
        const XReaderFactory &pReaderFactory,
        const XWriterFactory &pWriterFactory);
    XObject GetXmlObject();
public:
    static XObject CreateContentHandler(
        const XObject &pXmlObject,
        const Sax::XContentHandler &pContentHandler);
    static XObject CreateStream(
        const XObject &pXmlObject,
        const Sax::XXmlStream &pStream);
    static XObject CreateProcessor(
        const XObject &pXmlObject,
        const Sax::XXmlProcessor &pProcessor);
public:
    static Sax::XContentHandler 
        GetContentHandler(const XObject &pObject);
    static Sax::XXmlStream GetStream(const XObject &pObject);
    static Sax::XXmlProcessor GetProcessor(const XObject &pObject);
public:
    static Sax::XContentHandler 
        WrapContentHandler(const XObject &pObject);
    static Sax::XXmlStream WrapStream(const XObject &pObject);
    };

The XML extension package for the ECMAScript interpreter.

This class implements XML extensions for ECMAScript interpreter as specified in Unicorn ECMAScript Interpreter Reference Manual. XML Extensions Version 2.0.

Every object of this class must be associated with an ECMAScript interpreter (an object of class EcmaScript::CInterpreter ). When an XML extension package is constructed, the global object of the associated ECMAScript interpreter must be specified as an argument of the constructor. Once the CXmlExtension object is constructed, its member function Register must be called in order to create the initial set of XML extension objects in the object space of the associated ECMAScript interpreter.

This class also provides few static functions supporting creation and type casting for ECMAScript objects implemented by XML extensions.

Since:
1.00.00
Version:
1.00.00
Author:
Alexey Gokhberg
See Also:
EcmaScript::CObject, EcmaScript::CGlobalObject, Sax::CContentHandler, Sax::CXmlStream, Sax::CXmlProcessor, Sax::CXmlReaderFactory, XmlWriter::CXmlWriterFactory
Constructor/Destructor Summary
CXmlExtension (const XGlobalObject &pGlobalObject);
����������Constructs the XML extension package.
~CXmlExtension ();
����������Destroys the XML extension package.

Function Summary
void Register (const CString &strPropertyName, const XReaderFactory &pReaderFactory, const XWriterFactory &pWriterFactory);
����������Registers this XML extension package with the associated ECMAScript interpreter.
XObject GetXmlObject ();
����������Returns the XML extension root object.
XObject CreateContentHandler (const XObject &pXmlObject, const Sax::XContentHandler &pContentHandler);
����������Creates a new ECMAScript object representing the specified SAX content handler.
XObject CreateStream (const XObject &pXmlObject, const Sax::XXmlStream &pStream);
����������Creates a new ECMAScript object representing the specified XML stream.
XObject CreateProcessor (const XObject &pXmlObject, const Sax::XXmlProcessor &pProcessor);
����������Creates a new ECMAScript object representing the specified XML processor.
Sax::XContentHandler GetContentHandler (const XObject &pObject);
����������Returns a SAX content handler represented by the specified ECMAScript object.
Sax::XXmlStream GetStream (const XObject &pObject);
����������Returns an XML stream represented by the specified ECMAScript object.
Sax::XXmlProcessor GetProcessor (const XObject &pObject);
����������Returns an XML processor represented by the specified ECMAScript object.
Sax::XContentHandler WrapContentHandler (const XObject &pObject);
����������Returns a SAX content handler, which wraps event processing ECMAScript function properties associated with the specified ECMAScript object.
Sax::XXmlStream WrapStream (const XObject &pObject);
����������Returns an XML stream, which wraps event processing ECMAScript function properties associated with the specified ECMAScript object.

Constructor/Destructor Detail

CXmlExtension

CXmlExtension(const XGlobalObject &pGlobalObject);

Constructs the XML extension package.

Parameters:
pGlobalObject - the ECMAScript global object. The ECMAScript interpreter which owns the specified global object will be associated with this XML extension package.

~CXmlExtension

~CXmlExtension();

Destroys the XML extension package.

Function Detail

Register

void Register(
    const CString &strPropertyName,
    const XReaderFactory &pReaderFactory,
    const XWriterFactory &pWriterFactory);

Registers this XML extension package with the associated ECMAScript interpreter.

This function creates the initial set of XML extension objects in the object space of the ECMAScript interpreter associated with this XML extension package.

The following information is required for the package registration:

Parameters:
strPropertyName - a string containing the name of the global object property to be bound to the XML extension root object
pReaderFactory - the reader factory for generation of new XML readers
pWriterFactory - the writer factory for generation of new XML writers

GetXmlObject

XObject GetXmlObject();

Returns the XML extension root object.

Returns:
the XML extension root object

CreateContentHandler

static XObject CreateContentHandler(
    const XObject &pXmlObject,
    const Sax::XContentHandler &pContentHandler);

Creates a new ECMAScript object representing the specified SAX content handler.

The internal [[Class]] property of the newly created object will be set to "XML.ContentHandler" .

Parameters:
pXmlObject - the XML extension root object
pContentHandler - the SAX content handler
Returns:
the newly created ECMAScript object representing the specified content handler

CreateStream

static XObject CreateStream(
    const XObject &pXmlObject,
    const Sax::XXmlStream &pStream);

Creates a new ECMAScript object representing the specified XML stream.

The internal [[Class]] property of the newly created object will be set to "XML.Stream" .

Parameters:
pXmlObject - the XML extension root object
pStream - the XML stream
Returns:
the newly created ECMAScript object representing the specified XML stream

CreateProcessor

static XObject CreateProcessor(
    const XObject &pXmlObject,
    const Sax::XXmlProcessor &pProcessor);

Creates a new ECMAScript object representing the specified XML processor.

The internal [[Class]] property of the newly created object will be set to "XML.Processor" .

Parameters:
pXmlObject - the XML extension root object
pProcessor - the XML processor
Returns:
the newly created ECMAScript object representing the specified XML processor

GetContentHandler

static Sax::XContentHandler 
    GetContentHandler(const XObject &pObject);

Returns a SAX content handler represented by the specified ECMAScript object.

The object must represent a SAX content handler (that is, the ContentHandler prototype must appear in the object's prototype chain).

Parameters:
pObject - the ECMAScript object
Returns:
the SAX content handler represented by the specified ECMAScript object

GetStream

static Sax::XXmlStream GetStream(const XObject &pObject);

Returns an XML stream represented by the specified ECMAScript object.

The object must represent an XML stream (that is, the Stream prototype must appear in the object's prototype chain).

Parameters:
pObject - the ECMAScript object
Returns:
the XML stream represented by the specified ECMAScript object

GetProcessor

static Sax::XXmlProcessor GetProcessor(const XObject &pObject);

Returns an XML processor represented by the specified ECMAScript object.

The object must represent an XML processor (that is, the Processor prototype must appear in the object's prototype chain).

Parameters:
pObject - the ECMAScript object
Returns:
the XML processor represented by the specified ECMAScript object

WrapContentHandler

static Sax::XContentHandler 
    WrapContentHandler(const XObject &pObject);

Returns a SAX content handler, which wraps event processing ECMAScript function properties associated with the specified ECMAScript object.

The object must represent a SAX content handler (that is, its prototype chain must contain the ContentHandler prototype).

Parameters:
pObject - the ECMAScript object
Returns:
the SAX content handler, which wraps event processing ECMAScript function properties associated with the specified object

WrapStream

static Sax::XXmlStream WrapStream(const XObject &pObject);

Returns an XML stream, which wraps event processing ECMAScript function properties associated with the specified ECMAScript object.

The object must represent an XML stream (that is, its prototype chain must contain the Stream prototype).

Parameters:
pObject - the ECMAScript object
Returns:
the XML stream, which wraps event processing ECMAScript function properties associated with the specified object

Unicorn XML Toolkit
Version 1.00.00


This document was created using Unicorn DOC++.

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