Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ownerDocument Property

 

Returns the root of the document that contains the node.

var objXMLDOMDocument = oXMLDOMNode.ownerDocument;  

Example

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

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
var currNode;
var owner;
xmlDoc.async = false;
xmlDoc.load("books.xml");
if (xmlDoc.parseError.errorCode != 0) {
   var myErr = xmlDoc.parseError;
   WScript.Echo("You have error " + myErr.reason);
} else {
   currNode =    xmlDoc.documentElement.childNodes.item(0).childNodes.item(1);
   owner = currNode.ownerDocument;
   WScript.Echo(owner.documentElement.tagName);
}

Set objXMLDOMDocument = oXMLDOMNode.ownerDocument  

HRESULT get_ownerDocument(  
    IXMLDOMDocument **DOMDocument);  

Parameters

DOMDocument[out, retval]
Address of the parent document object that represents the root of the document.

C/C++ Return Values

S_OK
Value returned if successful.

E_INVALIDARG
Value returned if the DOMDocument parameter is Null.

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

All nodes are created in the context of a document, and the ownerDocument property is maintained until the node is added to another document. For a node removed from a document, this property indicates the document in which the node was last included.

Implemented in:

MSXML 3.0, MSXML 6.0

IXMLDOMAttribute | IXMLDOMCDATASection | IXMLDOMCharacterData | IXMLDOMComment | IXMLDOMDocument-DOMDocument | IXMLDOMDocumentFragment | IXMLDOMDocumentType | IXMLDOMElement | IXMLDOMEntity | IXMLDOMEntityReference | IXMLDOMNode | IXMLDOMNotation | IXMLDOMProcessingInstruction | IXMLDOMText

Show:
© 2018 Microsoft