XML DOM namespaceURIProperty


Element object

Definition and Usage

The namespaceURI attribute returns the namespace URI of the selected element.

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

Syntax

elementNode.namespaceURI

Example

The following code snippet usesloadXMLDoc()put "books_ns.xml" Load into xmlDoc, and get the namespace URI from the first <title> element:

Example

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

document.write(x.namespaceURI);

The above code will output:

http://www.example.com/w3cnote/

Try it Yourself »

Element objectother extensions