Unicorn XML Toolkit
Version 1.50.00

Namespace Dom
Class INode

class INode {
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:
    const WCHAR *GetNodeName();
    const WCHAR *GetNodeValue();
    void SetNodeValue(const WCHAR *pszValue);
    int GetNodeType();
    XNode GetParentNode();
    XNodeList GetChildNodes();
    XNode GetFirstChild();
    XNode GetLastChild();
    XNode GetPreviousSibling();
    XNode GetNextSibling();
    XNamedNodeMap GetAttributes();
    XDocument GetOwnerDocument();    
    XNamedNodeMap GetNamespaces();
public:
    XNode InsertBefore(INode *pNewChild, INode *pRefChild);
    XNode ReplaceChild(INode *pNewChild, INode *pOldChild);
    XNode RemoveChild(INode *pOldChild);
    XNode AppendChild(INode *pNewChild);
    bool HasChildNodes();
    XNode CloneNode(bool bDeep);
    const WCHAR *GetNamespaceUri();
    const WCHAR *GetLocalName();
    int GetDocumentId();
    int GetNodeId();
    CString GetStringValue();
    };
typedef XRefCnt<INode> XNode;

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.50.00
Author:
Alexey Gokhberg
See Also:
INodeList, INamedNodeMap, IDocument
Function Summary
const�WCHAR�* GetNodeName ();
����������Returns the name of this node.
const�WCHAR�* GetNodeValue ();
����������Returns the value of this node.
void SetNodeValue (const WCHAR *pszValue);
����������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 (INode *pNewChild, INode *pRefChild);
����������Inserts the node specified by pNewChild before the node specified by pRefChild into the children list of this node.
XNode ReplaceChild (INode *pNewChild, INode *pOldChild);
����������Replaces the node specified by pOldChild with the node specified by pNewChild in the children list of this node.
XNode RemoveChild (INode *pOldChild);
����������Removes the node specified by pOldChild from the children list of this node.
XNode AppendChild (INode *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.
const�WCHAR�* GetNamespaceUri ();
����������Returns the namespace URI of this node.
const�WCHAR�* 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.

Function Detail

GetNodeName

const WCHAR *GetNodeName();

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

const WCHAR *GetNodeValue();

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

void SetNodeValue(const WCHAR *pszValue);

Sets the new value of this node.

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

This method is not supported by XDM.

Parameters:
pszValue - the new value for this node

GetNodeType

int GetNodeType();

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

XNode GetParentNode();

Returns the parent node of this node.

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

If the document model is DOM, and this node is an attribute, this method returns NULL .

If the document model is XDM, and 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

XNodeList GetChildNodes();

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.

This method is not supported by XDM.

Returns:
the list of child nodes of this node

GetFirstChild

XNode GetFirstChild();

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

XNode GetLastChild();

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

XNode GetPreviousSibling();

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

XNode GetNextSibling();

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

XNamedNodeMap GetAttributes();

Returns the attribute map of this node.

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

If the node supports XDM, 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

XDocument GetOwnerDocument();

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

XNamedNodeMap GetNamespaces();

Returns the namespace map of this node

This is an extension having no equivalent in DOM.

This method is not supported by DOM.

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

InsertBefore

XNode InsertBefore(INode *pNewChild, INode *pRefChild);

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.

This method is not supported by XDM.

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

XNode ReplaceChild(INode *pNewChild, INode *pOldChild);

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.

This method is not supported by XDM.

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

RemoveChild

XNode RemoveChild(INode *pOldChild);

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.

This method is not supported by XDM.

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

AppendChild

XNode AppendChild(INode *pNewChild);

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.

This method is not supported by XDM.

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

HasChildNodes

bool HasChildNodes();

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

XNode CloneNode(bool bDeep);

Creates a copy of this node.

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

This method is not supported by XDM.

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

const WCHAR *GetNamespaceUri();

Returns the namespace URI of this node.

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.

This method is not supported by DOM.

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

GetLocalName

const WCHAR *GetLocalName();

Returns the local name of this node.

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

This method is not supported by DOM.

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

GetDocumentId

int GetDocumentId();

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.

This method is not supported by DOM.

Returns:
the unique identifier of the document owning this node

GetNodeId

int GetNodeId();

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.

This method is not supported by DOM.

Returns:
the unique identifier of this node within a document

GetStringValue

CString GetStringValue();

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

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

This method is not supported by DOM.

Returns:
the string value of this node

Unicorn XML Toolkit
Version 1.50.00


This document was created using Unicorn DOC++.

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