XML DOM ownerDocument 屬性

定義和用法
ownerDocument 屬性返回節點所屬的根元素(document 對象)。
語法
attrObject.ownerDocument
實例
下麵的代碼片段使用 loadXMLDoc() 把 "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
