XML DOM ownerDocument Property
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