Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XML DOM lookupNamespaceURI() Method

XML DOM lookupNamespaceURI() Method


Element Object Reference Element Object


Definition and Usage

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

Syntax

elementNode.lookupNamespaceURI(prefix)

Parameters Description
prefix Required. A string specifying the prefix to look for.

Example

The following code snippet uses loadXMLDoc() to load "books_ns.xml" Load into xmlDoc, and in the first element look up the namespace URI for the "c" prefix:

Example

xmlDoc=loadXMLDoc("books_ns.xml");

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

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

Output:

http://www.runoob.com/w3cnote/

Try it »


Element Object Reference Element Object