XML DOM namespaceURI property

Node object reference manual

Definition and usage

The namespaceURI property can return the namespace URI of a node.

Syntax:

nodeObject.namespaceURI

Instance

In all examples, we will use the XML file books_ns.xml loadXMLDoc()

The following code snippet can return the namespace URI of the <title> element:

xmlDoc=loadXMLDoc("books_ns.xml");
var x=xmlDoc.getElementsByTagName('title');
for(i=0;i<x.length;i++)
  {
  document.write(x.item(i).namespaceURI
  document.write("<br />");
  

Output:

http://www.codew3c.com/children/
http://www.codew3c.com/xml/

Node object reference manual