The nodeName property returns the name of a node, depending on its type.
The following code fragment loads "books.xml" into xmlDoc using loadXMLDoc(), displays the node name and node type of the root node:
Output:
Display nodeName and nodeValue of all elements