PROPERTY:  Object::nodeName

Object  Attr   CDATASection   CharacterData   Comment   Document   DocumentFragment   DocumentType   Entity   EntityReference   Node   Notation   ProcessingInstruction   Text
 
Object.nodeName

The nodeName property is read-only and contains the name of the node, depending on type. This name is a string value and is never empty. The various types of name returned by each node are detailed below.

The following example uses the 'states.xml' file and obtains the node names of the document itself, and of the document's root node.

XML:
<States>
   <State ref="FL">
      <name>Florida</name>
      <capital>Tallahassee</capital>
   </State>
   <State ref="IA">
      <name>Iowa</name>
      <capital>Des Moines</capital>
   </State>
</States>

Code (JavaScript):
var xml_doc = new ActiveXObject("Microsoft.XMLDOM");
xml_doc.async = false;
xml_doc.load("states.xml");

var n = xml_doc;
document.write(n.nodeName);
n = xml_doc.documentElement;
document.write("<br>" + n.nodeName);

Output:
#document
States



Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information