Node Object
Last Updated: 08-27-2005
Represents a generic node object in an XML document.

attributes Retrieves an Attributes collection of Attribute objects.
childNodes Retrieves a NodeList collection of node objects.
firstChild Retrieves the first child of the Node in document source order.
lastChild Returns the last child of the Node object in document source order.
localName Retrieves the local name of the node.
namespaceURI Retrieves the namespace URI of the node.
nextSibling Retrieves the next sibling of the Node in document source order.
nodeName Retrieves the name of the node.
nodeType Retrieves the type of the node.
nodeValue Retrieves the value of the node.
ownerDocument Retrieves a reference to the Document object that contains the Node.
parentNode Retrieves the parent Node to which the node belongs.
prefix Retrieves the namespace prefix of the node.
previousSibling Retrieves the previous sibling of the Node in document source order.
text Retrieves the contents of all the text nodes contained by the Node and any element nodes that it contains. **

hasAttributes Returns whether or not the Node has attributes.
hasChildNodes Returns whether or not the Node has children.

Attribute, Element, TextNode, CDATASection, Comment, ProcessingInstruction, and Document are each a special type of Node object.
In Tellme's implementation, prior to revision 3 a CDATASection is treated as a TextNode, but CDATASection nodes are treated independently of TextNodes in revision 3 and later.
Given a variable holding a reference to a Node object, use the nodeType property to determine the specific type of node object.
If the nodeType property of a Node object returns the value 1, the node is an Element. Use the childNodes property of that element to access a collection of its children, if any.

The example below uses the following data.

<?xml version="1.0"?>
<?access-control allow="*"?>
   <name>Ford Motor Company</name>

The following example walks the children of the the root document element and prints the nodeName and the data of the TextNode contained within each element to the debug log.

<vxml version="2.0">
   <data name="oData" src="quote.exml"/>
      // cache the root document element
      var oRoot = oData.documentElement;
      // retrieve the collection of children from the root doc element
      var oChildren = oRoot.childNodes;
      // iterate
      for (var i = 0; i < oChildren.length; i++)
         // cache each child node in a temporary variable
         var oNode = oChildren.item(i);
         // *in this data set* each element node contained within the root element
         // contains a text node containing the desired data
         vxmllog(oNode.nodeName + "=" +;

[24]7 Inc.| Terms of Service| Privacy Policy| General Disclaimers