Welcome to WebmasterWorld Guest from 50.16.84.67

Forum Moderators: httpwebwitch

Child Node Names and ASP

How I can identify which link node I wish to use?

   
3:06 pm on Feb 26, 2007 (gmt 0)

10+ Year Member



I'm using ASP to loop through each child in a RSS feed to display the title, URL and description:
=======================================
for each child in RSSItem.childNodes
if lcase(child.nodeName)="title" then response.write child.text
if lcase(child.nodeName)="link" then response.write child.text
if lcase(child.nodeName)="content" then response.write child.text
next
=======================================

However, each item in the RSS feed contains two URLs, e.g.

<link rel='alternate' type='text/html' href='http://link1'></link>
<link rel='self' type='application/atom+xml' href='http://link2'></link>

The ASP code is not returning any child text for the <link> node.

Can anyone shed any light how I can identify which link I wish to use, and display it accordingly?

Thanks in advance,

Chris

5:30 am on Feb 27, 2007 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Try

if lcase(child.nodeName)="link" then response.write child.rel

not familar with ASP but assume "text" is what is between start and end tags

3:24 pm on Feb 27, 2007 (gmt 0)

10+ Year Member



No luck, I'm afraid, this returns an error - object not supported.

Anyone else got any ideas?

Chris

12:26 am on Feb 28, 2007 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



guess 2, visual basic? is not my field so syntax be BAD, may wish to try microsoft IIS forum

for each child in RSSItem.childNodes
if lcase(child.nodeName)="title" then response.write child.text
if lcase(child.nodeName)="link" then begin
for each at in child.attributes
if at.name="rel" then response.write at.value
next
end
if lcase(child.nodeName)="content" then response.write child.text
next

4:25 pm on Mar 1, 2007 (gmt 0)

10+ Year Member



Dave, you are a genius, and I appreciate the time you have taken to resolve it for me.

Your last snippet of code was sooo close, and it just needed a little tweaking to get the results I needed.

Here was the final code:

for each at in child.attributes
if at.name="href" then response.write at.text &"<br>"
next

Thank you so much.

Chris

 

Featured Threads

Hot Threads This Week

Hot Threads This Month