Share via


IXMLDOMNamedNodeMap.length (C#)

banner art

Previous Next

IXMLDOMNamedNodeMap.length (C#)

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

Syntax

  int = IXMLDOMNamedNodeMap
  .length;

Remarks

The property is read-only.

Example Code

The following example creates an IXMLDOMNamedNodeMap object and then uses its length property to support iteration.

using Microsoft.WindowsMediaServices.Interop;
using interop_msxml;

// Declare variables.
WMSServer Server;
IXMLDOMDocument Playlist;
IXMLDOMNodeList NodeList;
IXMLDOMNode node;
IXMLDOMNamedNodeMap namedNodeMap;

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 attributes that appear in the first element with
    // the node name "media" and display the total count.
    NodeList = Playlist.getElementsByTagName("media");
    node = NodeList[0];
    namedNodeMap = node.attributes;

    // Display the node value associated with each attribute 
    // in the collection.
    for (int i = 0; i < namedNodeMap.length; i++)
    {
        MessageBox.Show(namedNodeMap[i].nodeValue.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