Click to return to the XML (Extensible Markup Language) home page    
XMLDOMNode nodeValue Prop...     XMLDOMNode parentNode Pro...     XMLDOMNode Object    
Web Workshop  |  XML (Extensible Markup Language)

ownerDocument Property


Returns the root of the document that contains this node.

Syntax

objXMLDOMDocument = oXMLDOMNode.ownerDocument

Remarks

Object. The property is read-only. It returns the parent document object 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.

Example

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

Dim xmlDoc
Dim currNode
Dim owner

Set xmlDoc = CreateObject("microsoft.xmldom")
xmlDoc.async = False
xmlDoc.load("c:\books.xml")
Set currNode = xmlDoc.documentElement.childNodes.item(0).childNodes.item(1)
Set owner =  currNode.ownerDocument
MsgBox owner.documentElement.tagName

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
XMLDOMAttribute, XMLDOMCDATASection, XMLDOMCharacterData, XMLDOMComment, XMLDOMDocument, XMLDOMDocumentFragment, XMLDOMDocumentType, XMLDOMElement, XMLDOMEntity, XMLDOMEntityReference, XMLDOMNode, XMLDOMNotation, XMLDOMProcessingInstruction, XMLDOMText, XTLRuntime


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.