Microsoft XML SDK 2.6 - XML Reference

item Method (XMLDOMNodeList)

Allows random access to individual nodes within the collection.

objXMLDOMNode = oXMLDOMNodeList.item(index)

Parameters

index
Long integer. Index of the item within the collection. The first item is zero.

Return Value

Object. Returns an XMLDOMNode object. Returns Null if the index is out of range.

Example

The following VBScript example creates an XMLDOMNodeList object with the document's getElementsByTagName method. It then iterates through the collection, displaying the text value of each item in the list:

Dim xmlDoc
Dim objNodeList
Set xmlDoc = CreateObject("Msxml2.DOMDocument")
xmlDoc.async = False
xmlDoc.load("c:\books.xml")
Set objNodeList = xmlDoc.getElementsByTagName("AUTHOR")
For i = 0 To (objNodeList.length -1)
  MsgBox (objNodeList.item(i).text)
Next

See Also

Applies To: XMLDOMNodeList Object | XMLDOMSelection Object