nextNode Method (IXMLDOMNamedNodeMap)

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - DOM Reference

nextNode Method (IXMLDOMNamedNodeMap)

Returns the next node in the collection.

[Script]

Script Syntax

var objXMLDOMNode = oXMLDOMNamedNodeMap.nextNode();

Return Value

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

Example

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

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.5.0");
var objNamedNodeMap;
var objNode;
xmlDoc.async = false;
xmlDoc.load("books.xml");
if (xmlDoc.parseError.errorCode <> 0) {
   var myErr = xmlDoc.parseError;
   alert("You have error " + myErr.reason);
} else {
   objNamedNodeMap = xmlDoc.documentElement.childNodes(1).attributes;
   for (var i=0; i<objNamedNodeMap.length; i++) {
      objNode = objNamedNodeMap.nextNode();
      alert(objNode.text);
   }
}
[Visual Basic]

Visual Basic Syntax

Set objXMLDOMNode = oXMLDOMNamedNodeMap.nextNode

Return Value

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

Example

The following Microsoft® Visual Basic® example creates an IXMLDOMNamedNodeMap object and uses its nextNode method to iterate the collection.

Dim xmlDoc As New Msxml2.DOMDocument50
Dim objNamedNodeMap As IXMLDOMNamedNodeMap
Dim objNode As IXMLDOMNode
xmlDoc.async = False
xmlDoc.Load ("books.xml")
If (xmlDoc.parseError.errorCode <> 0) Then
   Dim myErr
   Set myErr = xmlDoc.parseError
   MsgBox("You have error " & myErr.reason)
Else
   Set objNamedNodeMap = xmlDoc.documentElement.childNodes(1).Attributes
   For i = 0 To (objNamedNodeMap.length - 1)
      Set objNode = objNamedNodeMap.nextNode
      MsgBox objNode.Text
   Next
End If
[C/C++]

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.

C/C++ Return Values

S_OK
The value returned if successful.
S_FALSE
The value when returning Null.
E_INVALIDARG
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).

To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

IXMLDOMNode | reset Method

Applies to: IXMLDOMNamedNodeMap | IXMLDOMNodeList | IXMLDOMSelection