IXMLDOMNamedNodeMap.item (Visual Basic .NET)

banner art

Previous Next

IXMLDOMNamedNodeMap.item (Visual Basic .NET)

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

Syntax

  IXMLDOMNode = IXMLDOMNamedNodeMap
  .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 IXMLDOMNamedNodeMap object with the document's getElementsByTagName method. It then iterates through the collection, displaying the node value of 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 objNamedNodeMap As IXMLDOMNamedNodeMap

' 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 each node in the list.
For i = 0 To (objNodeList.length - 1)
  MsgBox objNamedNodeMap.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