Unicorn XML Toolkit
Version 1.00.00

Namespace Dom
Class INode

class INode: virtual public CInterface {
public:
    enum {
        ELEMENT_NODE = 1,
        ATTRIBUTE_NODE = 2,
        TEXT_NODE = 3,
        CDATA_SECTION_NODE = 4,
        ENTITY_REFERENCE_NODE = 5,
        ENTITY_NODE = 6,
        PROCESSING_INSTRUCTION_NODE = 7,
        COMMENT_NODE = 8,
        DOCUMENT_NODE = 9,
        DOCUMENT_TYPE_NODE = 10,
        DOCUMENT_FRAGMENT_NODE = 11,
        NOTATION_NODE = 12,
        NAMESPACE_NODE = 13
        };
public:
    INode();
    virtual ~INode();
public:
    virtual CString GetNodeName() = 0;
    virtual CString GetNodeValue() = 0;
    virtual void SetNodeValue(const CString &strValue) = 0;
    virtual int GetNodeType() = 0;
    virtual XNode GetParentNode() = 0;
    virtual XNodeList GetChildNodes() = 0;
    virtual XNode GetFirstChild() = 0;
    virtual XNode GetLastChild() = 0;
    virtual XNode GetPreviousSibling() = 0;
    virtual XNode GetNextSibling() = 0;
    virtual XNamedNodeMap GetAttributes() = 0;
    virtual XDocument GetOwnerDocument() = 0;    
    virtual XNamedNodeMap GetNamespaces() = 0;
public:
    virtual XNode InsertBefore(
        const XNode &pNewChild, const XNode &pRefChild) = 0;
    virtual XNode ReplaceChild(
        const XNode &pNewChild, const XNode &pOldChild) = 0;
    virtual XNode RemoveChild(const XNode &pOldChild) = 0;
    virtual XNode AppendChild(const XNode &pNewChild) = 0;
    virtual bool HasChildNodes() = 0;
    virtual XNode CloneNode(bool bDeep) = 0;    
    virtual CString GetNamespaceUri() = 0;
    virtual CString GetPrefix() = 0;
    virtual CString GetLocalName() = 0;
    virtual int GetDocumentId() = 0;
    virtual int GetNodeId() = 0;
    virtual CString GetStringValue() = 0;
    virtual XNode GetNextDescendant(const XNode &pNode) = 0;
    virtual XNode GetNextNode() = 0;
    virtual XNode GetPreviousNode() = 0;
    virtual bool LookupPrefix(
        const CString &strPrefix, CString &strNamespaceUri) = 0;
    virtual bool SupportsExtensions() = 0;
    };

The single node in the document tree.

This class implements, with several extensions, the C++ binding for the Node interface specified by DOM.

Since:
1.00.00
Version:
1.00.00
Author:
Alexey Gokhberg
See Also:
INodeList, INamedNodeMap, IDocument
Constructor/Destructor Summary
INode ();
����������Constructs the node.
~INode ();
����������Destroys the node.

Function Summary
CString GetNodeName ();
����������Returns the name of this node.
CString GetNodeValue ();
����������Returns the value of this node.
void SetNodeValue (const CString &strValue);
����������Sets the new value of this node.
int GetNodeType ();
����������Returns the type of this node.
XNode GetParentNode ();
����������Returns the parent node of this node.
XNodeList GetChildNodes ();
����������Returns the list of child nodes of this node.
XNode GetFirstChild ();
����������Returns the first child node of this node.
XNode GetLastChild ();
����������Returns the last child node of this node.
XNode GetPreviousSibling ();
����������Returns the previous sibling node of this node.
XNode GetNextSibling ();
����������Returns the next sibling node of this node.
XNamedNodeMap GetAttributes ();
����������Returns the attribute map of this node.
XDocument GetOwnerDocument ();
����������Returns the owner document node of this node.
XNamedNodeMap GetNamespaces ();
����������Returns the namespace map of this node
XNode InsertBefore (const XNode &pNewChild, const XNode &pRefChild);
����������Inserts the node specified by pNewChild before the node specified by pRefChild into the children list of this node.
XNode ReplaceChild (const XNode &pNewChild, const XNode &pOldChild);
����������Replaces the node specified by pOldChild with the node specified by pNewChild in the children list of this node.
XNode RemoveChild (const XNode &pOldChild);
����������Removes the node specified by pOldChild from the children list of this node.
XNode AppendChild (const XNode &pNewChild);
����������Appends the node specified by pNewChild to the end of children list of this node.
bool HasChildNodes ();
����������Tests whether this node has children nodes.
XNode CloneNode (bool bDeep);
����������Creates a copy of this node.
CString GetNamespaceUri ();
����������Returns the namespace URI of this node.
CString GetPrefix ();
����������Returns the namespace prefix of this node.
CString GetLocalName ();
����������Returns the local name of this node.
int GetDocumentId ();
����������Returns the unique identifier of the document owning this node.
int GetNodeId ();
����������Returns the unique identifier of this node within a document.
CString GetStringValue ();
����������Returns the string value of this node, as defined by XPath.
XNode GetNextDescendant (const XNode &pNode);
����������Returns the node which follows this node in the subtree rooted at the node referenced by pNode , in the order established by the preorder traversal of that subtree.
XNode GetNextNode ();
����������Returns the node which follows this node, in the order established by the preorder traversal of the document tree.
XNode GetPreviousNode ();
����������Returns the node which precedes this node, in the order established by the preorder traversal of the document tree.
bool LookupPrefix (const CString &strPrefix, CString &strNamespaceUri);
����������Looks up the namepace URI associated with the prefix specified by strPrefix using namespace declarations in scope on this node.
bool SupportsExtensions ();
����������Tests whether this node supports XDM extensions.

Constructor/Destructor Detail

INode

INode();

Constructs the node.

~INode

virtual ~INode();

Destroys the node.

Function Detail

GetNodeName

virtual CString GetNodeName() = 0;

Returns the name of this node.

This method implements the C++ binding for the nodeName attribute specified by DOM.

Returns:
the name of this node

GetNodeValue

virtual CString GetNodeValue() = 0;

Returns the value of this node.

This method implements the C++ binding for the nodeValue attribute specified by DOM.

Returns:
the value of this node

SetNodeValue

virtual void SetNodeValue(const CString &strValue) = 0;

Sets the new value of this node.

This method implements the C++ binding for the nodeValue attribute specified by DOM.

Parameters:
strValue - the new value for this node

GetNodeType

virtual int GetNodeType() = 0;

Returns the type of this node.

This method implements the C++ binding for the nodeType attribute specified by DOM.

Returns:
the type of this node

GetParentNode

virtual XNode GetParentNode() = 0;

Returns the parent node of this node.

This method implements the C++ binding for the parentNode attribute specified by DOM.

If this node is an attribute or a namespace, this method returns the owner element node. This behavior is different from that specified by DOM, which requires the parentNode to be null for attribute nodes.

Returns:
the parent node of this node, or NULL if this node has no parent

GetChildNodes

virtual XNodeList GetChildNodes() = 0;

Returns the list of child nodes of this node.

This method implements the C++ binding for the childNodes attribute specified by DOM.

Attribute and namespace nodes are not treated as children of their owner element nodes.

Returns:
the list of child nodes of this node

GetFirstChild

virtual XNode GetFirstChild() = 0;

Returns the first child node of this node.

This method implements the C++ binding for the firstChild attribute specified by DOM.

Returns:
the first child node of this node, or NULL if this node has no children

GetLastChild

virtual XNode GetLastChild() = 0;

Returns the last child node of this node.

This method implements the C++ binding for the lastChild attribute specified by DOM.

Returns:
the last child node of this node, or NULL if this node has no children

GetPreviousSibling

virtual XNode GetPreviousSibling() = 0;

Returns the previous sibling node of this node.

This method implements the C++ binding for the previousSibling attribute specified by DOM.

Returns:
the previous sibling node of this node, or NULL if this node has no previous sibling

GetNextSibling

virtual XNode GetNextSibling() = 0;

Returns the next sibling node of this node.

This method implements the C++ binding for the nextSibling attribute specified by DOM.

Returns:
the next sibling node of this node, or NULL if this node has no next sibling

GetAttributes

virtual XNamedNodeMap GetAttributes() = 0;

Returns the attribute map of this node.

This method implements the C++ binding for attributes attribute specified by DOM.

If the node supports XDM extensions, then namespace attributes (i.e., those having names started with "xmlns" ") are not included in the attribute map.

Returns:
the attribute map of this node, or NULL if this node does not represent an element

GetOwnerDocument

virtual XDocument GetOwnerDocument() = 0;

Returns the owner document node of this node.

This method implements the C++ binding for parentNode attribute specified by DOM.

Returns:
the owner document node of this node

GetNamespaces

virtual XNamedNodeMap GetNamespaces() = 0;

Returns the namespace map of this node

This is an extension having no equivalent in DOM. If this node does not support XDM extensions, the returned namespace map is always empty.

Returns:
the namespace map of this node, or NULL if this node does not represent an element

InsertBefore

virtual XNode InsertBefore(
    const XNode &pNewChild, const XNode &pRefChild) = 0;

Inserts the node specified by pNewChild before the node specified by pRefChild into the children list of this node.

This method implements the C++ binding for the insertBefore operation specified by DOM.

Parameters:
pNewChild - the node to be inserted
pRefChild - the child node before which the new node must be inserted, or NULL if the new node must be appended to the end of the children list
Returns:
the node inserted (that referenced by pNewChild )

ReplaceChild

virtual XNode ReplaceChild(
    const XNode &pNewChild, const XNode &pOldChild) = 0;

Replaces the node specified by pOldChild with the node specified by pNewChild in the children list of this node.

This method implements the C++ binding for the replaceChild operation specified by DOM.

Parameters:
pNewChild - the replacing node
pOldChild - the node to replace
Returns:
the node replaced (that referenced by pOldChild )

RemoveChild

virtual XNode RemoveChild(const XNode &pOldChild) = 0;

Removes the node specified by pOldChild from the children list of this node.

This method implements the C++ binding for removeChild operation specified by DOM.

Parameters:
pOldChild - the node to remove
Returns:
the node removed (that referenced by pOldChild )

AppendChild

virtual XNode AppendChild(const XNode &pNewChild) = 0;

Appends the node specified by pNewChild to the end of children list of this node.

This method implements the C++ binding for the appendChild operation specified by DOM.

Parameters:
pNewChild - the node to append
Returns:
the node appended (that referenced by pNewChild )

HasChildNodes

virtual bool HasChildNodes() = 0;

Tests whether this node has children nodes.

This method implements the C++ binding for the hasChildren operation specified by DOM.

Returns:
true if this node has children nodes; false otherwise

CloneNode

virtual XNode CloneNode(bool bDeep) = 0;

Creates a copy of this node.

This method implements the C++ binding for the cloneNode operation specified by DOM.

Parameters:
bDeep - when true , this node is cloned together with all descendant nodes; when false , only this node is cloned
Returns:
the newly created copy

GetNamespaceUri

virtual CString GetNamespaceUri() = 0;

Returns the namespace URI of this node.

If this node supports XDM extensions, the namespace URI is determined using the namespace map attached to this node. If this node does not support XDM extensions, the namespace URI is determined using the namespace attributes attached to this node and to all ancestor nodes.

This is an extension XDM method that has no equivalent in DOM Level 1 and has very different semantics then the namespaceURI attribute defined by DOM Level 2.

Returns:
the namespace URI of this node, or the empty string if this node has null namespace URI or does not represent an element or an attribute

GetPrefix

virtual CString GetPrefix() = 0;

Returns the namespace prefix of this node.

This is an extension XDM method that has no equivalent in DOM Level 1.

Returns:
the namespace prefix of this node, or the empty string if this node has no prefix or does not represent an element or an attribute

GetLocalName

virtual CString GetLocalName() = 0;

Returns the local name of this node.

This is an extension XDM method that has no equivalent in DOM Level 1.

Returns:
the local name of this node, or the empty string if this node does not represent an element or an attribute

GetDocumentId

virtual int GetDocumentId() = 0;

Returns the unique identifier of the document owning this node.

The document identifier is an integer that is unique for each instance of IDocument class.

This is an extension XDM method that has no equivalent in DOM.

Returns:
the unique identifier of the document owning this node

GetNodeId

virtual int GetNodeId() = 0;

Returns the unique identifier of this node within a document.

The node identifier is an integer that is unique for each node within any single document. Node identifiers are not globally unique: nodes owned by different documents may have the same values of node identifiers.

Within each document, identifiers are assigned to nodes in order of their creation; nodes created first receive smaller identifiers.

This is an extension XDM method that has no equivalent in DOM.

Returns:
the unique identifier of this node within a document

GetStringValue

virtual CString GetStringValue() = 0;

Returns the string value of this node, as defined by XPath.

This is an extension XDM method that has no equivalent in DOM.

Returns:
the string value of this node

GetNextDescendant

virtual XNode GetNextDescendant(const XNode &pNode) = 0;

Returns the node which follows this node in the subtree rooted at the node referenced by pNode , in the order established by the preorder traversal of that subtree.

This is an extension XDM method that has no equivalent in DOM.

Parameters:
pNode - the root of the subtree
Returns:
the node which follows this node in the subtree rooted at the node referenced by pNode , in the order established by the preorder traversal of that subtree, or NULL if there is no such node in the subtree

GetNextNode

virtual XNode GetNextNode() = 0;

Returns the node which follows this node, in the order established by the preorder traversal of the document tree.

This is an extension XDM method that has no equivalent in DOM.

Returns:
the node which follows this node, in the order established by the preorder traversal of the document tree, or NULL if there is no such node

GetPreviousNode

virtual XNode GetPreviousNode() = 0;

Returns the node which precedes this node, in the order established by the preorder traversal of the document tree.

This is an extension XDM method that has no equivalent in DOM.

Returns:
the node which precedes this node, in the order established by the preorder traversal of the document tree, or NULL if there is no such node

LookupPrefix

virtual bool LookupPrefix(
    const CString &strPrefix, CString &strNamespaceUri) = 0;

Looks up the namepace URI associated with the prefix specified by strPrefix using namespace declarations in scope on this node.

If this node supports XDM extensions, the namespace URI is calculated using the namespace map attached to this node. If this node does not support XDM extensions, the namespace URI is calculated using the namespace attributes attached to this node and to all ancestor nodes.

The empty prefix can be specified using the empty string. The special value of "#default" can be also used to specify the empty prefix; this feature was introduced for interoperability with other libraries and is not recommended for use in the new software.

If the prefix specified is bound to the default namespace, the empty string is returned.

This is an extension XDM method that has no equivalent in DOM.

Parameters:
strPrefix - the prefix to search
strNamespaceUri - on return, the namespace URI bound to the prefix specified, or undefined if the prefix is not declared on this node
Returns:
true if the prefix is declared on this node; false otherwise

SupportsExtensions

virtual bool SupportsExtensions() = 0;

Tests whether this node supports XDM extensions.

This is an extension XDM method that has no equivalent in DOM.

Returns:
true if this node supports XDM extensions; false otherwise

Unicorn XML Toolkit
Version 1.00.00


This document was created using Unicorn DOC++.

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