XML DOM lookupPrefix () method
Definition and Usage
lookupPrefix () method returns the prefix specified in the match on the current node namespace URI.
grammar
elementNode.lookupPrefix(URI)
参数 | 描述 |
---|---|
URI | 必需。要查找的前缀的命名空间。 |
Examples
The following code fragment uses loadXMLDoc () to " books_ns.xml " into xmlDoc and find the namespace URI prefix in the first <book> element:
Examples
xmlDoc=loadXMLDoc("books_ns.xml");
x=xmlDoc.getElementsByTagName("book")[0];
document.write(x.lookupPrefix("http://www.w3cschool.cc/children/"));
x=xmlDoc.getElementsByTagName("book")[0];
document.write(x.lookupPrefix("http://www.w3cschool.cc/children/"));
Output:
c
try it"
Element object