XML DOM namespaceURI Property

Node Object Reference Manual

Definition and Usage

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

Syntax:

nodeObject.namespaceURI

Example

In all examples, we will use the XML file books_ns.xml, and the JavaScript function 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