Share via


IXMLDOMNode.removeChild (C#)

banner art

Previous Next

IXMLDOMNode.removeChild (C#)

The removeChild method removes the specified child node from the list of children and returns it.

Syntax

  IXMLDOMNode = IXMLDOMNode
  .removeChild(
  object objchildNode
);

Parameters

objchildNode

[in] object containing the child node to be removed from the list of children of this node.

Return Values

Returns the removed child node.

Example Code

The following example retrieves a child node and removes a node from its list of children.

using Microsoft.WindowsMediaServices.Interop;
using interop_msxml;

// Declare variables.
WMSServer Server;
IXMLDOMDocument Playlist;
IXMLDOMElement Root;
IXMLDOMNode currNode;
IXMLDOMNode oldChild;

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

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

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

    // Retrieve the root element.
    Root = Playlist.documentElement;

    // Retrieve the second child of the current node.
    currNode = Root.childNodes[1];

    // Remove the child of the current node.
    oldChild = currNode.removeChild(currNode.childNodes[1]);
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

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