XML DOM lookupNamespaceURI()Methods


Element object

Definition and Usage

The lookupNamespaceURI() method returns the namespace that matches the specified prefix on the current node.

Syntax

elementNode.lookupNamespaceURI(prefix)

Parameter Description
prefix Required. A string that specifies the prefix to look up.


Example

The following code snippet usesloadXMLDoc()put "books_ns.xmlLoad xmlDoc, and look up the namespace URI for the "c" prefix in the first <book> element:

Example

xmlDoc=loadXMLDoc("books_ns.xml");

x=xmlDoc.getElementsByTagName("book")[0];

document.write(x.lookupNamespaceURI("c"));

Output:

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

Try it Yourself »

Element objectother extensions