Share via


reset Method (IXMLDOMNodeList)

 

Resets the iterator.

JScript Syntax

oXMLDOMNodeList.reset();  

Example

The following script example creates an IXMLDOMNodeList object and iterates the collection using the nextNode method. It then uses the reset method to reset the iterator to point before the first node in the list.

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);
   }
   objNodeList.reset();
   objNode = objNodeList.nextNode();
   WScript.Echo(objNode.text);
}

Output

Gambardella, Matthew  
Ralls, Kim  
Corets, Eva  
...  

C/C++ Syntax

HRESULT reset(void);  

Return Values

S_OK
The value returned if successful.

Remarks

This method reinitializes the iterator to point before the first node in the IXMLDOMNodeList so that the next call to nextNode returns the first item in the list.

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

nextNode Method (IXMLDOMNodeList)
IXMLDOMNodeList
IXMLDOMSelection