Compability: Internet Explorer
This method returns the next node in the collection.
The iterator is initially positioned before the first item in the list,
so the first call to nextNode returns the first node.
If there are no items in the collection, or the current node is the
last, the nextNode method will return null. If the
current node is removed, subsequent calls to nextNode will also
return null unless the iterator is reset using the reset method.
XML:
<beers>
<beer>
<brewer>Badger</brewer>
<name>Tanglefoot</name>
</beer>
<beer>
<brewer>Wadworths</brewer>
<name>6X</name>
</beer>
<beer>
<brewer>Hop Back Brewery</brewer>
<name>Summer Lightning</name>
</beer>
</beers>
VBScript:
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load("beers.xml")
Set NodeList = objXMLDoc.getElementsByTagName("brewer")
numNodes = NodeList.Length
For i = 1 To NumNodes
Set CurrNode = NodeList.nextNode
document.write(CurrNode.text & "<br>")
Next
Badger
Wadworths
Hop Back Brewery
In this example we load the 'beers.xml' file and create a collection of all 'brewer' element nodes. The code then iterates through the collection using the nextNode method, and displays the text of each.