Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XML DOM ownerDocument Property

XML DOM ownerDocument Property


Attr Object Reference Attr object


Definition and Usage

The ownerDocument property returns the root element (document object) to which a node belongs.

Syntax

attrObject.ownerDocument


Example

The following code snippet uses loadXMLDoc() to load "books.xml" Load into xmlDoc, and return the root element of the first category attribute node:

Example

xmlDoc

=

loadXMLDoc

(

"

books.xml

"

)

;

x

=

xmlDoc

.

getElementsByTagName

(

'

book

'

)

;

document

.

write

(

x

.

item

(

0

)

.

attributes

[

0

]

.

ownerDocument

)

;

document

.

write

(

"


"

)

;

document

.

write

(

x

.

item

(

0

)

.

attributes

[

0

]

.

ownerDocument

.

nodeName

)

;

document

.

write

(

"


"

)

;

document

.

write

(

x

.

item

(

0

)

.

attributes

[

0

]

.

ownerDocument

.

nodeType

)

;

The code above will output:

[object XMLDocument]

#document

9

Try it »


Attr Object Reference Attr object