Name
ownerDocument: Document
Synopsis
Returns a reference to the Document
used to create this Node
object. Since the Document
object is the only mechanism
exposed for creating new nodes, even these newly created, empty
nodes have the ownerDocument
property set. This attribute can be null
only for Document
nodes and DocumentType
nodes that are not yet part
of a document. You can’t move a node directly to another document;
instead, you must import it. This property can be useful for
checking where a node came from.
Java binding
public Document getOwnerDocument( );
Java example
// Add my two cents Document doc = elem.getOwnerDocument( ); Text txtAdd = doc.createTextNode("My $.02"); elem.appendChild(txtAdd);
Get XML in a Nutshell, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.