IXMLDOMNode.firstChild (C#)

banner art

Previous Next

IXMLDOMNode.firstChild (C#)

The firstChild property contains the first child of the node.


  IXMLDOMNode = IXMLDOMNode.firstChild;


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 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
Returns the first child node. If there are no children, it returns NULL.
Returns NULL. This node type cannot have children.

Example Code

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

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;
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