IXMLDOMNamedNodeMap.getNamedItem (Visual Basic .NET)

banner art

Previous Next

IXMLDOMNamedNodeMap.getNamedItem (Visual Basic .NET)

The getNamedItem method retrieves the attribute with the specified name.

Syntax

  IXMLDOMNode = IXMLDOMNamedNodeMap
  .getNamedItem(
  strName As String
)

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 a node named "src" and assign it to an IXMLDOMAttribute object.

Imports interop_msxml
Imports Microsoft.WindowsMediaServices.Interop

On Error GoTo Err

' Declare variables.
Dim Server As New WMSServerClass()
Dim Playlist As IXMLDOMDocument
Dim Elem As IXMLDOMElement
Dim ChildList As IXMLDOMNodeList 
Dim XMLNamedNodeMap As IXMLDOMNamedNodeMap 
Dim XMLNode As IXMLDOMNode 

' Create a new playlist object.
Set 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.item(0).attributes

' Retrieve an attribute named "src".
XMLNode = XMLNamedNodeMap.getNamedItem("src")
Exit Sub

Err:
' TODO: Handle errors.

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