Share via


IXMLDOMNodeList.item (Visual Basic .NET)

banner art

Previous Next

IXMLDOMNodeList.item (Visual Basic .NET)

The item method allows random access to individual nodes within the IXMLDOMNodeList collection.

Syntax

  IXMLDOMNode = IXMLDOMNodeList
  .item(
  lIndex As Integer
)

Parameters

lIndex

[in] Integer containing the index of the item within the collection. The first item is zero.

Return Values

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

Example Code

The following example creates an IXMLDOMNodeList object using the document's getElementsByTagName method. It then iterates through the collection displaying the node value for each item in the list.

Imports interop_msxml
Imports Microsoft.WindowsMediaServices.Interop

On Error GoTo Err

' Declare variables.
Dim Server As New WMSServerClass()
Dim Playlist As IXMLDOMDocument
Dim objNodeList As IXMLDOMNodeList

' Create a new playlist object.
Set Playlist = Server.CreatePlaylist

' Load a playlist.
Playlist.Load (("file://c:\wmpub\wmroot\simple.wsx"))

' Retrieve all the elements with the tag name "media".
Set objNodeList = Playlist.getElementsByTagName("media")

' Display the node value for every node in the list.
For i = 0 To (objNodeList.length - 1)
  MsgBox objNodeList.Item(i).nodeValue
Next
Exit Sub

Err:
' TODO: Handle errors.

Requirements

Reference: Add references to Microsoft.WindowsMediaServices and interop_msxml.

Namespace: Microsoft.WindowsMediaServices.Interop, interop_msxml.

Assembly: Microsoft.WindowsMediaServices.dll, interop_msxml.dll.

Library: WMSServerTypeLib.dll, msxml.dll.

Platform: Windows Server 2003 family, Windows Server 2008 family.

See Also

Previous Next