IXMLDOMNode.firstChild (Visual Basic .NET)

banner art

Previous Next

IXMLDOMNode.firstChild (Visual Basic .NET)

The firstChild property contains the first child of the node.

Syntax

  IXMLDOMNode = IXMLDOMNode.firstChild

Remarks

The property is read-only. It returns the first child node. If there are no children, it returns NULL.

The value of the IXMLDOMNode object that is returned depends on the type of node on which the firstChild property is called, as shown in the following table. For example, if the node type is NODE_ELEMENT, an IXMLDOMNode object is returned containing the first child node for that element node.

Node type Value returned
NODE_ATTRIBUTE
NODE_DOCUMENT
NODE_ELEMENT
Returns the first child node. If there are no children, it returns NULL.
NODE_COMMENT
NODE_PROCESSING_INSTRUCTION
NODE_TEXT
Returns NULL. This node type cannot have children.

Example Code

The following example retrieves the first child node of the top-level node.

Imports interop_msxml
Imports Microsoft.WindowsMediaServices.Interop

On Error GoTo Err

' Declare variables.
Dim Server As New WMSServerClass()
Dim Playlist As IXMLDOMDocument
Dim currNode As IXMLDOMNode

' Create a new playlist object.
Set Playlist = Server.CreatePlaylist

' Load a playlist.
Playlist.Load ("file://c:\wmpub\wmroot\simple.wsx")

' Retrieve the first child node of the root element.
Set currNode = Playlist.documentElement.firstChild
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