XML DOM lookupPrefix()Methods
Element object
Definition and Usage
The lookupPrefix() method returns the prefix that matches the specified namespace URI on the current node.
Syntax
elementNode.lookupPrefix(URI)
| Parameter | Description |
|---|---|
| URI | Required. The namespace of the prefix to look up. |
Example
The following code snippet usesloadXMLDoc()put "books_ns.xmlLoad into xmlDoc, and find the prefix of 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.example.com/w3cnote/"));
Output:
c
Try it Yourself »
Element objectother extensions