XML DOM nodeName Property
Document Object
Definition and Usage
The nodeName property returns the name of a node, according to its type.
Syntax
documentObject.nodeName
Example
The following code snippet uses loadXMLDoc() to load "books.xml" Load into xmlDoc, and display the node name and node type of the root node:
Example
xmlDoc=loadXMLDoc("books.xml");
document.write("Nodename: " + xmlDoc.nodeName);
document.write(" (nodetype: " + xmlDoc.nodeType);
Output:
Nodename: #document (nodetype: 9)
Try it »
Try it
Display the node names and node values of all elements
Document Object