Share via


IXMLDOMNode.ownerDocument (C#)

banner art

Previous Next

IXMLDOMNode.ownerDocument (C#)

The ownerDocument property returns the root of the document that contains the node.

Syntax

  IXMLDOMDocument = IXMLDOMNode.ownerDocument;

Remarks

The property is read-only. It returns the parent document that represents the root of the document to which this node belongs.

Example Code

The following example uses the ownerDocument property to return the parent IXMLDOMDocument object, and then displays that object's root element tag name.

using Microsoft.WindowsMediaServices.Interop;
using interop_msxml;

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

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 second child node of the first child node
    // in the root element.
    currNode = Playlist.documentElement.childNodes[0].childNodes[1];

    // Display the owner document's root element tag name.
    Owner = currNode.ownerDocument;
    MessageBox.Show(owner.documentElement.tagName.ToString());
}
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