XML DOM ownerDocument プロパティ
Attr オブジェクト
定義と用法
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 オブジェクト
|