XML DOM ownerDocumentプロパティ
Attr オブジェクト
定義と用法
ownerDocument プロパティは、ノードが属するルート要素(document オブジェクト)を返します。
構文
attrObject.ownerDocument
例
以下のコードスニペットはloadXMLDoc()を使用して、"を 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
試してみる »
Attr オブジェクト その他の拡張