XML DOM ownerDocument 属性

定义和用法
ownerDocument 属性返回节点所属的根元素(document 对象)。
语法
attrObject.ownerDocument
下面的代码片段使用 books.xml" 载入 xmlDoc 中,并返回第一个 category 属性节点的根元素:
实例代码
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName('book');
document.write(x.item(0).attributes[0].ownerDocument);
document.write("<br>");
document.write(x.item(0).attributes[0].ownerDocument.nodeName);
document.write("<br>");
document.write(x.item(0).attributes[0].ownerDocument.nodeType);
上面的代码将输出:
[object XMLDocument]
#document
9
#document
9
