XML DOM lookupNamespaceURI()Methods
Node object
Definition and Usage
The lookupNamespaceURI() method returns the namespace URI that matches the specified prefix on a node.
Syntax
nodeObject.lookupNamespaceURI(prefix)
| Parameter | Description |
|---|---|
| prefix | Required. Prefix. |
Example
The following code snippet usesloadXMLDoc()put "books_ns.xmlLoad into xmlDoc, and find the namespace URI to which the prefix "c" belongs in the first <book> element:
Example
xmlDoc=loadXMLDoc("books_ns.xml");
x=xmlDoc.getElementsByTagName("book")[0];
document.write(x.lookupNamespaceURI("c"));
x=xmlDoc.getElementsByTagName("book")[0];
document.write(x.lookupNamespaceURI("c"));
Output:
http://www.example.com/w3cnote/
Try it Yourself »
Node objectother extensions