Share via


IXMLDOMNamedNodeMap.getNamedItem (C#)

banner art

Previous Next

IXMLDOMNamedNodeMap.getNamedItem (C#)

The getNamedItem method retrieves the attribute with the specified name.

Syntax

  IXMLDOMNode = IXMLDOMNamedNodeMap
  .getNamedItem(
  string strName
);

Parameters

strName

[in] string specifying the name of the attribute.

Return Values

Returns an IXMLDOMNode object for the specified attribute. The method returns NULL if the attribute node is not in this collection.

Example Code

The following example uses the getNamedItem method to retrieve an attribute named "src".

using Microsoft.WindowsMediaServices.Interop;
using interop_msxml;

// Declare variables.
WMSServer Server;
IXMLDOMDocument Playlist;
IXMLDOMElement Elem;
IXMLDOMNodeList ChildList;
IXMLDOMNamedNodeMap XMLNamedNodeMap;
IXMLDOMNode XMLNode;

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 pointer to the root element.
    Elem = Playlist.documentElement;

    // Retrieve a list of the child nodes.
    ChildList = Elem.childNodes;

    // Retrieve the list of attributes for the first
    // node in the child node list.
    XMLNamedNodeMap = ChildList[0].attributes;

    // Retrieve an attribute named "src".
    XMLNode = XMLNamedNodeMap.getNamedItem("src"); 
}
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