By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,282 Members | 1,562 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,282 IT Pros & Developers. It's quick & easy.

parsing the <link> element tag

P: n/a
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?

Thanks,
-Doug

Jun 23 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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

Jun 24 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.