IXMLDOMNodeList.reset (C#)

banner art

Previous Next

IXMLDOMNodeList.reset (C#)

The reset method resets the iterator in the collection of nodes.

Syntax

  IXMLDOMNodeList
  .reset();

Parameters

This method takes no parameters.

Return Values

This method does not return a value.

Remarks

This method reinitializes the iterator to point before the first node in the IXMLDOMNodeList collection so that the next call to nextNode returns the first item in the list.

This method is an extension of the World Wide Web Consortium (W3C) Document Object Model (DOM).

Example Code

The following example creates an IXMLDOMNodeList object and iterates through the collection using the nextNode method. It then uses the reset method to reset the iterator to point before the first node in the list.

using Microsoft.WindowsMediaServices.Interop;
using interop_msxml;

// Declare variables.
WMSServer Server;
IXMLDOMDocument Playlist;
IXMLDOMNodeList NodeList;
IXMLDOMNode objNode;

try {
    // Create a new WMSServer object.
    Server = new WMSServerClass();

    // Create a new playlist object.
    Playlist = Server.CreatePlaylist();

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

    // Retrieve a list of media elements that match the query.
    NodeList = Playlist.getElementsByTagName("media");

    // Retrieve each node in the list.
    for(int i = 0; i < NodeList.length; i++)
    {
        objNode = NodeList.nextNode();
    }

    // Reset the iterator so that the following call to
    // nextNode() returns the first node in the list.
    NodeList.reset();
    objNode = NodeList.nextNode();
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

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