XML DOM baseURI Property
Definition and Usage
The baseURI property can return the absolute base URI of a node.
Syntax
nodeObject.baseURI
Example
In all examples, we will use the XML file books_ns.xml, and the JavaScript function loadXMLDoc().
The following code snippet can return the absolute base URI of <title>:
xmlDoc=loadXMLDoc("books_ns.xml");
var x=xmlDoc.getElementsByTagName('title');
for(i=0;i<x.length;i++)
{
document.write(x.item(i).baseURI
);
document.write("<br />");
}
Output:
http://www.codew3c.com/dom/books_ns.xml http://www.codew3c.com/dom/books_ns.xml
TIY
- Get the prefix, local name, namespace URI, and absolute base URI of a node(Not supported by IE)