XML DOM namespaceURI 屬性

定義和用法
namespaceURI 屬性設置或返回屬性的命名空間 URI。
語法
attrObject.namespaceURI
實例
下麵的代碼片段使用 loadXMLDoc() 把 "books_ns.xml" 載入 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>");
}
