XML DOM namespaceURI Property
Definition and Usage
The namespaceURI property returns the namespace URI of the selected node.
If the selected node is not an element or attribute, this property returns NULL.
Syntax:
elementNode.namespaceURI
Example
In all examples, we will use the XML file books.xml, and the JavaScript function loadXMLDoc().
The following code snippet retrieves the namespace URI of the first <title> element from "books_ns.xml":
xmlDoc=loadXMLDoc("books_ns.xml");
x=xmlDoc.getElementsByTagName("title")[0];
document.write(x.namespaceURI
);
The output of the above code is:
http://www.codew3c.com/children/