IXMLDOMNodeList.length (C#)

banner art

Previous Next

IXMLDOMNodeList.length (C#)

The length property indicates the number of items in the IXMLDOMNodeList collection.

Syntax

  int = IXMLDOMNodeList
  .length;

Remarks

The property is read-only.

Example Code

The following example creates an IXMLDOMNodeList object and then uses its length property to retrieve the total number of "media" elements.

using Microsoft.WindowsMediaServices.Interop;
using interop_msxml;

// Declare variables.
WMSServer Server;
IXMLDOMDocument Playlist;
IXMLDOMNodeList nodeList;

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 all elements that appear in elements with
    // the tag name "media" and display the total count.
    nodeList = Playlist.getElementsByTagName("media");
    MessageBox.Show(NodeList.length.ToString());

     }
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