473,405 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

parsing the <link> element tag

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
1 1947
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Francesco Moi | last post by:
Hello. I'm trying to build a RSS feed for my website. It starts: ----------------//--------------------- <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE rss PUBLIC "-//Netscape...
6
by: Todd Peterson | last post by:
I'm encountering some wierd behavior with a <link> tag over an HTTPS connection, vs. an HTTP connection... In an ASP/HTML page on my website, I've add a <link rel="shortcut icon"...> in order to...
2
by: brw | last post by:
Is there a way to dynamically add a link tag to the head block of an ..aspx page? I'm aware that you can add a link tag (or literal control) statically and then dynamically modify the attributes....
2
by: Gopalan | last post by:
Hi I was using <link href="...." type="..."> tag inside the .aspx file. When I converted this aspx file to ascx file and use it in an aspx file it is not working properly. Please tell me...
1
by: Baldoni | last post by:
It's been years since putting together a page. This line in my HTML: <link type="text/css" rel="stylesheet" href="net4801style.css"> gives this problem (via weblint HTML checker): attribute...
4
by: John A Grandy | last post by:
When constructing an RSS 2.0 XML doc , should the <channel><link> element's value be 1. the url of the page the displays the content that the RSS feed describes : fox example:...
6
by: Spartanicus | last post by:
I'd like to execute a function when a <link rel="next" href="foo.htm"> type element is used. Although the "onclick" handler is allowed on the element, presumably because the functionality of the...
9
by: Arancaytar | last post by:
I have so far seen two methods for including external resources as CSS stylesheets in a document. The first is this: <link href="/stylesheets/style.css" rel="stylesheet" type="text/css" /> And...
1
by: Rick | last post by:
Hello, The masterpage of the site has a <divelement that encloses the "content" of the actual aspx page. The content page has a <linkelement. When I try to switch from "source" view to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.