Do**********@gmail.com wrote:
I am attempting to parse and xml file using javascript but am running
into a problem when parsing a <link></link> pair. For example, the
link information in most RSS feeds is given as
<link> http://www.something.com/someotherstuff </link>
However, when I use item.getElementsByTagName("link"), I get an empty
HTMLLinkObject back and if I print the innerHTML property of item, the
<link> tag shows up but not the </link> tag. Does anyone know of a
javascript solution to this?
<script type="text/javascript">
if (window.ActiveXObject) {
xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
xmlDoc.async = false;
xmlDoc.load('file.xml');
doAlert();
}
else if (document.implementation
&& document.implementation.createDocument) {
xmlDoc = document.implementation.createDocument('', '', null);
xmlDoc.load('file.xml');
xmlDoc.onload = doAlert;
}
else {
alert('Browser canīt support script!');
}
function doAlert() {
alert(xmlDoc.getElementsByTagName('link')[0].firstChild.nodeValue);
}
</script>
--
Bart