Easy Tutorial
❮ Dom Comment Met Node Lookupnamespaceuri ❯

XML DOM lookupPrefix() Method



Definition and Usage

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

Syntax

Parameter Description
URI Required. The namespace of the prefix to look up.

Example

The following code snippet uses loadXMLDoc() to load "books_ns.xml" into xmlDoc and finds the prefix for the namespace URI in the first <book> element:

Example

xmlDoc=loadXMLDoc("books_ns.xml");

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

document.write(x.lookupPrefix("http://www.tutorialpro.org/w3cnote/"));

Output:

❮ Dom Comment Met Node Lookupnamespaceuri ❯