Share via


IXMLDOMNode.hasChildNodes (Visual Basic .NET)

banner art

Previous Next

IXMLDOMNode.hasChildNodes (Visual Basic .NET)

The hasChildNodes method returns a Boolean value indicating whether this node has children.

Syntax

  bValue = IXMLDOMNode
  .hasChildNodes

Parameters

This method contains no parameters.

Return Values

Returns True if this node has children.

Remarks

This method always returns False for nodes that, by definition, cannot have children.

Example Code

The following example checks a node to determine whether it has any child nodes. If it does, the number of child nodes is displayed.

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

' Check whether the node has child nodes.
If currNode.hasChildNodes Then
  MsgBox currNode.childNodes.length
Else
  MsgBox "no child nodes"
End If
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