XML DOM nodeName property
Definition and usage
The nodeName property can return the name of the node based on its type.
Syntax:
nodeObject.nodeName
Instance
In all examples, we will use the XML file books.xml, as well as the JavaScript function loadXMLDoc().
The following code snippet can display the node name and node type of the root node:
xmlDoc=loadXMLDoc("books.xml");
document.write("Nodename: " + xmlDoc.nodeName
);
document.write(" (nodetype: " + xmlDoc.nodeType);
Output:
Nodename: #document (nodetype: 9)