nextNode Method (IXMLDOMNodeList)

 

Returns the next node in the collection.

JScript Syntax

var objXMLDOMNode = oXMLDOMNodeList.nextNode();  

Return Value

An IXMLDOMNode refers to the next node in the collection. Returns Null if there is no next node.

Example

The following script example creates an IXMLDOMNodeList object and uses its nextNode method to iterate the collection.

Note

You can use books.xml to run this sample code.

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.6.0");
var objNodeList;
var objNode;
xmlDoc.async = false;
xmlDoc.load("books.xml");
if (xmlDoc.parseError.errorCode != 0) {
   var myErr = xmlDoc.parseError;
   WScript.Echo("You have error " + myErr.reason);
} else {
   objNodeList = xmlDoc.getElementsByTagName("author");
   for (var i=0; i<objNodeList.length; i++) {
      objNode = objNodeList.nextNode();
      WScript.Echo(objNode.text);
   }
}

Output

Gambardella, Matthew

Ralls, Kim

Corets, Eva

...

C/C++ Syntax

HRESULT nextNode(  
    IXMLDOMNode **nextItem);  

Parameters

nextItem[out, retval]
The next node in the collection, or Null if there is no next node.

Return Values

S_OK
The value returned if successful.

S_FALSE
The value returned if the nextItem parameter is Null.

Remarks

The iterator initially points before the first node in the list so that the first call to the nextNode method returns the first node in the list.

This method returns Null when the current node is the last node or there are no items in the list. When the current node is removed from the list, subsequent calls to nextNode return Null. The iterator must be reset by calling the reset method.

This member is an extension of the Worldwide Web Consortium (W3C) Document Object Model (DOM).

Versioning

Implemented in: MSXML 3.0 and MSXML 6.0

See Also

IXMLDOMNode
reset Method (IXMLDOMNamedNodeMap)
IXMLDOMNamedNodeMap
IXMLDOMNodeList
IXMLDOMSelection