Partager via


IXMLDOMNodeList Object (Visual Basic .NET)

The IXMLDOMNodeList object supports iteration through the live collection, in addition to indexed access. For more information, see the Microsoft XML SDK 3.0 documentation available at the Microsoft Web site.

The IXMLDOMNodeList object supports the following property and methods.

Property

Description

length

Indicates the number of items in the collection. Read-only.

Method

Description

item

Allows random access to individual nodes within the collection.

nextNode*

Returns the next node in the collection.

reset*

Resets the iterator in the collection of nodes.

* Denotes an extension to the W3C DOM.

Remarks

A node list collection is live; that is, the addition and removal of nodes, and changes within nodes, are immediately reflected in the collection. This means that two successive requests for items using the same index can return two different items, depending on changes to the collection. This also means that changes to the node objects are immediately available in the nodes obtained from the list. The collection can also be accessed using the "for...next" construct.

Example

The following example creates an IXMLDOMNodeList object and displays the number of nodes 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 sample playlist file.
Playlist.Load ("file://c:\wmpub\wmroot\simple.wsx")

' Retrieve all elements with the node name "smil".
Set objNodeList = Playlist.getElementsByTagName("smil")
' Display the total number of nodes in the list.
MsgBox objNodeList.length
Exit Sub

Err:
' TODO: Handle errors.

See Also

Reference

IXMLDOMDocument Object (Visual Basic .NET)