Latest web development tutorials

XML DOM namespaceURI property

Element Object Reference Element object

Definition and Usage

namespaceURI property returns the namespace URI selected element.

If the node is not an element or attribute is selected, the property always returns NULL.

grammar

elementNode.namespaceURI

Examples

The following code fragment uses loadXMLDoc () to " books_ns.xml " into xmlDoc and obtain namespace URI from the first <title> element:

Examples

xmlDoc=loadXMLDoc("books_ns.xml");
x=xmlDoc.getElementsByTagName("title")[0];

document.write(x.namespaceURI);

The code above will output:

http://www.w3cschool.cc/children/

try it"

Element Object Reference Element object