Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xpath - how to limit results 1

Status
Not open for further replies.

tebathe3

Programmer
Jan 17, 2004
89
US
I am using xpath to bring back an rss feed in visual studio. i only want to bring back the first 10 entries. how can i do that? my current statement is "rss/channel/item"
 
If you look at the code that I submitted in the thread just before this one, I'm doing an xpath statement and checking the values of each node in a do while statement.

You should be able to do something similar but incorporate a timer instead of comparing each value.

In other words, set a numeric variable to "0", check the first node, increment it by one, test to see if it equals 10, if not do it again (loop) and keep going until it equals 10, then exit the do while.

Know what I mean? What language are you using?
 
Simply use:
Code:
rss/channel/item[position() < 11]

Jon

"Asteroids do not concern me, Admiral. I want that ship, not excuses.
 
I tried substituting this line you said:

rss/channel/item[position() < 11]

and it said incorrect syntax.....i'm new to this....
 
sorry it actually says it has an invalid token. whatever that means.
 
Didnt read you were using visual studio. In that case:
Code:
rss/channel/item[position() < 11]

Jon

"Asteroids do not concern me, Admiral. I want that ship, not excuses.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top