XML DOM namespaceURIプロパティ


Attr 对象参考手册Attr オブジェクト

定義と使い方

namespaceURI プロパティは、属性の名前空間 URI を設定または返します。

構文

attrObject.namespaceURI


例

以下のコードスニペットは、loadXMLDoc()"" を xmlDoc に読み込み、"lang" 属性の名前空間 URI を返します:

例

xmlDoc=loadXMLDoc("books_ns.xml"); x=xmlDoc.getElementsByTagName('book'); ​ for(i=0;i<x.length;i++) { document.write("Prefix: " + x.item(i).attributes[0].prefix); document.write("<br>"); document.write("Local name: " + x.item(i).attributes[0].localName); document.write("<br>"); document.write("Namespace URI: " + x.item(i).attributes[0].namespaceURI); document.write("<br>"); document.write("Base URI: " + x.item(i).attributes[0].baseURI); document.write("<br>"); document.write("<br>"); }

試してみる »

Attr 对象参考手册Attr オブジェクト その他の拡張