XML DOM namespaceURI 属性

返回上一级

XML DOM Attr 对象的 namespaceURI 属性设置或返回属性的命名空间 URI

语法

attrObject.namespaceURI

范例

下面的范例返回 "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>");
}

运行范例 »

返回上一级

XML DOM 基础教程

关于   |   FAQ   |   我们的愿景   |   广告投放   |  博客

  简单教程,简单编程 - IT 入门首选站

Copyright © 2013-2022 简单教程 twle.cn All Rights Reserved.