Click to return to the XML (Extensible Markup Language) home page    
XMLDOMNodeList length Pro...     XMLDOMNodeList Object    
Web Workshop  |  XML (Extensible Markup Language)

item Method


Allows random access to individual nodes within the collection.

Syntax

objXMLDOMNode = oXMLDOMNodeList.item(index)

Parameters

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

Returns

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

Example

The following 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("microsoft.xmldom")
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

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
XMLDOMNodeList


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.