IXMLDOMNode.hasChildNodes (C#)

banner art

Previous Next

IXMLDOMNode.hasChildNodes (C#)

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


  bValue = IXMLDOMNode


This method takes no parameters.

Return Values

Returns true if this node has children, and false if it does not.


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.

using Microsoft.WindowsMediaServices.Interop;
using interop_msxml;

// Declare variables.
WMSServer Server;
IXMLDOMDocument Playlist;
IXMLDOMNode currNode;

try {
    // Create a new WMSServer object.
    Server = new WMSServerClass();

    // Create a new playlist object.
    Playlist = Server.CreatePlaylist();

    // Load a playlist.

    // Retrieve the first child node of the root element.
    currNode = Playlist.documentElement.firstChild;

    // Check whether the node has child nodes.
    if (currNode.hasChildNodes() == true)
        MessageBox.Show("no child nodes");
catch (Exception e) {
    // TODO: Handle exceptions.


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