XML DOM baseURI Property
Definition and Usage
The baseURI property returns the absolute base URI of the attribute (attribute).
Syntax:
elementNode.baseURI
Example
In all examples, we will use the XML file books.xml, and the JavaScript function loadXMLDoc().
The following example returns the base URI of the "lang" attribute:
xmlDoc=loadXMLDoc("/example/xdom/books_ns.xml");
var x=xmlDoc.getElementsByTagName('title');
for(i=0;i<x.length;i++)
{
document.write(x.item(i).attributes[0].baseURI
);
document.write("<br />");
}
The output of the above code is:
http://www.codew3c.com/example/xdom/books.xml http://www.codew3c.com/example/xdom/books.xml http://www.codew3c.com/example/xdom/books.xml http://www.codew3c.com/example/xdom/books.xml
Try It Yourself
- Get the base URI of the attribute(Not supported by IE browser)