The lookupPrefix() method returns the prefix associated with a given namespace URI.
The lookupPrefix() method is supported in all major browsers.
Note: Internet Explorer 9 and earlier does not support this method.
Parameter | Type | Description |
---|---|---|
namespaceURI | String | Required. Specifies the namespace URI to look for |
Type | Description |
---|---|
String | The prefix associated with the specified namespace URI |
DOM Version | Core Level 3 Node Object |
---|
The following code fragment loads "books_ns.xml" into xmlDoc using loadXMLDoc() and finds the prefix for the given namespace URI:
Output: