Easy Tutorial
❮ Met Cdata Deletedata Dom Validate ❯

XML DOM lookupPrefix() Method



Definition and Usage

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

Syntax

Parameter Description
URI Required. The namespace URI.

Example

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

Example

xmlDoc = loadXMLDoc("books_ns.xml");

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

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

Output:

❮ Met Cdata Deletedata Dom Validate ❯