XML DOM namespaceURI property
Definition and usage
The namespaceURI property sets or returns the namespace URI of the attribute.
Syntax:
attrObject.namespaceURI
instance
In all examples, we will use the XML file books_ns.xml loadXMLDoc()
The following code snippet returns the namespace URI of the "lang" attribute:
xmlDoc=loadXMLDoc("/example/xdom/books_ns.xml");
var x=xmlDoc.getElementsByTagName('title');
for(i=0;i<x.length;i++)
{
document.write(x.item(i).attributes[0].namespaceURI
document.write("<br />");
The output of the above code is:
http://www.codew3c.com/children/ http://www.codew3c.com/xml/