Share via


IXMLDOMNode Object (C#)

The IXMLDOMNode object provides methods that represent the core functionality of any node. For more information, see the Microsoft XML SDK 3.0 documentation available at the Microsoft Web site.

The IXMLDOMNode object supports the following properties and methods.

Property

Description

attributes

Contains the list of attributes for this node. Read-only.

childNodes

Contains a node list containing the children (for nodes that can have children). Read-only.

firstChild

Contains the first child of this node. Read-only.

lastChild

Contains the last child of this node. Read-only.

nextSibling

Contains the next sibling of this node in the parent's child list. Read-only.

nodeName

Contains the qualified name of the element, attribute, or entity reference, or a fixed string for other node types. Read-only.

nodeType

Specifies the XML DOM node type, which determines valid values and whether the node can have child nodes. Read-only.

nodeTypeString*

Contains the node type in string form. Read-only.

nodeValue

Contains the text associated with the node. Read/write.

ownerDocument

Returns the root of the document that contains this node. Read-only.

parentNode

Contains the parent node (for nodes that can have parents). Read-only.

previousSibling

Contains the left sibling of this node. Read-only.

*Denotes an extension to the W3C DOM.

Method

Description

appendChild

Appends the supplied new child as the last child of this node.

cloneNode

Creates a new node that is an exact clone of this node.

hasChildNodes

Returns a Boolean value indicating whether this node has children.

insertBefore

Inserts a child node before the specified node or at the end of the list.

removeChild

Removes the specified child node from the list of children and returns it.

replaceChild

Returns the specified old child node and replaces it with the supplied new child node.

Example

The following example creates an IXMLDOMNode object and displays the node name for that node.

using Microsoft.WindowsMediaServices.Interop;
using interop_msxml;

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

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

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

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

    // Retrieve the first node and display the node name.
    Node = Playlist.documentElement.childNodes[0];
    MessageBox.Show(Node.nodeName.ToString());
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

See Also

Reference

IXMLDOMDocument Object (C#)