472,135 Members | 1,211 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

ASP RSS Parser

I found a nice ASP RSS Parser script. But the only thing is that is parses all the articles in the feed. i only need to parse the top three in the rss feed. and limit the description to 170 characters... Can someone please help me out with this? I am real new to asp and would apreciate any help!

Thanks Ben.
Sep 24 '07 #1
1 2157
3,406 Expert 2GB

notice the lines that say:
Expand|Select|Wrap|Line Numbers
  1. Dim objItem
  2. For Each objItem in objItems
This is what says to go through each line. If you only want three, then change it to something like this:
Expand|Select|Wrap|Line Numbers
  1. Dim objItem, x
  2. x = 0
  3. For Each objItem in objItems
  4.    x = x + 1
  5.    if x > 3 then exit for 
Does this make sense? I just added a counter called "x" and it exits after three times through the for... next loop. This probably isn't the best way to exit the loop (it is generally considered a bad idea to exit loops this way unless you are troubleshooting an error) but this is a simple way to exit from a loop that someone else wrote and you don't have to worry about whether the loop will advance the right way if you change it. Anyway, let me know if this helps.

Sep 24 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

13 posts views Thread by Paulo Pinto | last post: by
11 posts views Thread by Jean de Largentaye | last post: by
3 posts views Thread by Himanshu Garg | last post: by
5 posts views Thread by thewarden | last post: by
28 posts views Thread by Marc Gravell | last post: by
18 posts views Thread by Just Another Victim of the Ambient Morality | last post: by

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.