homepage Welcome to WebmasterWorld Guest from 50.17.66.61
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

    
Child Node Names and ASP
How I can identify which link node I wish to use?
Chris_H

5+ Year Member



 
Msg#: 3264204 posted 3:06 pm on Feb 26, 2007 (gmt 0)

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

 

daveVk

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3264204 posted 5:30 am on Feb 27, 2007 (gmt 0)

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

Chris_H

5+ Year Member



 
Msg#: 3264204 posted 3:24 pm on Feb 27, 2007 (gmt 0)

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

Anyone else got any ideas?

Chris

daveVk

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3264204 posted 12:26 am on Feb 28, 2007 (gmt 0)

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

Chris_H

5+ Year Member



 
Msg#: 3264204 posted 4:25 pm on Mar 1, 2007 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved