When using methods or properties like childNodes or
getElementsByTagName(), we receive a NodeList object.
A
NodeList object represent an ordered list of nodes.
The nodes in the NodeList can be accessed using their index
number (starting from 0).
Note: In a NodeList, the nodes are returned in the
order in which they are specified in the XML file.
Look at the XML file which is bookdetails.xml in
XML DOM Node page
We will now create a node list of all the <title> element in
"bookdetails.xml", by using the getElementsByTagName("title") method.
The following image represent the node list returned:
|