METHOD:  NodeList::nextNode

This method is a Microsoft extension to the W3C DOM.

NodeList.nextNode( )

The nextNode 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.

In the following 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.

      <brewer>Hop Back Brewery</brewer>
      <name>Summer Lightning</name>

Code (VBScript):
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False

Set NodeList = objXMLDoc.getElementsByTagName("brewer")
numNodes = NodeList.Length
For i = 1 To NumNodes
   Set CurrNode = NodeList.nextNode
   document.write(CurrNode.text & "<br>")

Hop Back Brewery

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information