XML DOM lookupPrefix() Method
Element Object
Definition and Usage
The lookupPrefix() method returns the prefix matching the specified namespace URI on the current node.
Syntax
elementNode.lookupPrefix(URI)
| Parameters | Description |
|---|---|
| URI | Required. The namespace of the prefix to look for. |
Example
The following code snippet uses loadXMLDoc() to load "books_ns.xml" Load into xmlDoc, and in the first
Example
xmlDoc
=
loadXMLDoc
(
"
books_ns.xml
"
)
;
x
=
xmlDoc
.
getElementsByTagName
(
"
book
"
)
[
0
]
;
document
.
write
(
x
.
lookupPrefix
(
"
http://www.runoob.com/w3cnote/
"
)
)
;
Output:
c
Try it »
Element Object