ホーム HTML CSS XML JAVASCRIPT   PHP SQL MORE...   リファレンス 事例集    

XML DOM ownerDocument プロパティ


Attr Object Reference Attr オブジェクト

定義と用法

ownerDocument プロパティは、ノードのルート要素 (文書オブジェクト) を返します。

構文

attrObject.ownerDocument


次のコードは、loadXMLDoc() を使用して xmlDoc に "books.xml" をロードし、 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

試してください »

Attr Object Reference Attr オブジェクト