IXMLDOMNamedNodeMap.item (C#)
Previous | Next |
IXMLDOMNamedNodeMap.item (C#)
The item method allows random access to individual nodes within the IXMLDOMNamedNodeMap collection.
Syntax
IXMLDOMNode = IXMLDOMNamedNodeMap [ int lIndex ];
Parameters
lIndex
[in] int containing the index of the item within the collection. The first item is zero.
Return Values
Returns an IXMLDOMNode object. Returns NULL if the index is out of range.
Example Code
The following example creates an IXMLDOMNamedNodeMap object with the document's getElementsByTagName method. It then iterates through the collection, displaying the node value of each item in the list.
using Microsoft.WindowsMediaServices.Interop; using interop_msxml; // Declare variables. WMSServer Server; IXMLDOMDocument Playlist; IXMLDOMNodeList NodeList; IXMLDOMNamedNodeMap objNamedNodeMap; 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 the elements with the tag name "media". NodeList = Playlist.getElementsByTagName("media"); // Display the node value for each node in the list. for(int i = 0; i < NodeList.length; i++) { objNamedNodeMap = NodeList[i].attributes; for(int j = 0; j < objNamedNodeMap.length; j++) { MessageBox.Show(objNamedNodeMap[j].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 |