Unicorn XML Toolkit
Version 1.00.00

Namespace EcmaScriptDom
Class CDomExtension

class CDomExtension {
public:
    CDomExtension(const XGlobalObject &pGlobalObject);
    ~CDomExtension();
public:
    void Register(
        const CString &strPropertyName,
        const XDocumentFactory &pDocumentFactory,
        const XObject &pXmlObject);
    XObject GetDomObject();
    static XDocument GetDocument(const XObject &pObject);
public:
    static XObject CreateNode(
        const XObject &pDomObject,
        const XNode &pNode);
public:
    static XNode GetNode(const XObject &pObject);
    static XNodeList GetNodeList(const XObject &pObject);
    static XNamedNodeMap GetNamedNodeMap(const XObject &pObject);
    };

The DOM extension package for the ECMAScript interpreter.

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

Every object of this class must be associated with an ECMAScript interpreter (an object of class EcmaScript::CInterpreter ). When a DOM extension package is constructed, the global object of the associated ECMAScript interpreter must be specified as an argument of the constructor. Once the CDomExtension object is constructed, its member function Register must be called in order to create the initial set of DOM 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 DOM extensions.

Since:
1.00.00
Version:
1.00.00
Author:
Alexey Gokhberg
See Also:
CDocumentFactory, EcmaScript::CObject, EcmaScript::CGlobalObject, Dom::INode, Dom::INodeList, Dom::INamedNodeMap, Dom::IDocument
Constructor/Destructor Summary
CDomExtension (const XGlobalObject &pGlobalObject);
����������Constructs the DOM extension package.
~CDomExtension ();
����������Destroys the DOM extension package.

Function Summary
void Register (const CString &strPropertyName, const XDocumentFactory &pDocumentFactory, const XObject &pXmlObject);
����������Registers this DOM extension package with the associated ECMAScript interpreter.
XObject GetDomObject ();
����������Returns the DOM extension root object.
XDocument GetDocument (const XObject &pObject);
����������Returns a DOM document represented by the specified ECMAScript object.
XObject CreateNode (const XObject &pDomObject, const XNode &pNode);
����������Creates a new ECMAScript object representing the specified DOM node.
XNode GetNode (const XObject &pObject);
����������Returns a DOM node represented by the specified ECMAScript object.
XNodeList GetNodeList (const XObject &pObject);
����������Returns a DOM node list represented by the specified ECMAScript object.
XNamedNodeMap GetNamedNodeMap (const XObject &pObject);
����������Returns a DOM named node map represented by the specified ECMAScript object.

Constructor/Destructor Detail

CDomExtension

CDomExtension(const XGlobalObject &pGlobalObject);

Constructs the DOM extension package.

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

~CDomExtension

~CDomExtension();

Destroys the DOM extension package.

Function Detail

Register

void Register(
    const CString &strPropertyName,
    const XDocumentFactory &pDocumentFactory,
    const XObject &pXmlObject);

Registers this DOM extension package with the associated ECMAScript interpreter.

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

The XML extension package (see EcmaScriptXml::CXmlExtension ), must be constructed and registered prior to the registration of this DOM 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 DOM extension root object
pDocumentFactory - the document factory for generation of new DOM documents
pXmlObject - the XML extension root object

GetDomObject

XObject GetDomObject();

Returns the DOM extension root object.

Returns:
the DOM extension root object

GetDocument

static XDocument GetDocument(const XObject &pObject);

Returns a DOM document represented by the specified ECMAScript object.

The value of the internal [[Class] property of the specified object must be "DOM.Document" (that is, the specified object must represent DOM document); otherwise the assertion error will be signaled.

Parameters:
pObject - the ECMAScript object
Returns:
the DOM document represented by the specified object

CreateNode

static XObject CreateNode(
    const XObject &pDomObject,
    const XNode &pNode);

Creates a new ECMAScript object representing the specified DOM node.

The internal [[Class]] property of the newly created object will be set to "DOM.Node" , regardless of the actual DOM node type.

Parameters:
pDomObject - the DOM extension root object
pNode - the DOM node
Returns:
the newly created ECMAScript object representing the specified node

GetNode

static XNode GetNode(const XObject &pObject);

Returns a DOM node represented by the specified ECMAScript object.

The value of the internal [[Class] property of the specified object must be one of "DOM.Node" , "DOM.DocumentFragment" , "DOM.Document" , "DOM.CharacterData" , "DOM.Attr" , "DOM.Element" , "DOM.Text" , "DOM.Comment" , "DOM.CDATASection" , "DOM.EntityReference" , or "DOM.ProcessingInstruction (that is, the specified object must represent a DOM node); otherwise the assertion error will be signaled.

Parameters:
pObject - the ECMAScript object
Returns:
the DOM node represented by the specified ECMAScript object

GetNodeList

static XNodeList GetNodeList(const XObject &pObject);

Returns a DOM node list represented by the specified ECMAScript object.

The value of the internal [[Class] property of the specified object must be "DOM.NodeList" (that is, the specified object must represent a DOM node list); otherwise the assertion error will occur.

Parameters:
pObject - the ECMAScript object
Returns:
the DOM node list represented by the specified ECMAScript object

GetNamedNodeMap

static XNamedNodeMap GetNamedNodeMap(const XObject &pObject);

Returns a DOM named node map represented by the specified ECMAScript object.

The value of the internal [[Class] property of the specified object must be "DOM.NamedNodeMap" (that is, the specified object must represent a DOM named node map); otherwise the assertion error will be signaled.

Parameters:
pObject - the ECMAScript object
Returns:
the DOM named node map represented by the specified ECMAScript object

Unicorn XML Toolkit
Version 1.00.00


This document was created using Unicorn DOC++.

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