+1
Answered

Access information from an individual RSS/XML item

doug 12 years ago updated by icahill (Administrator) 12 years ago 1
How do you access an individual "post" or entry out of an RSS/XML feed? I am able to display the feed in its entirety just fine, but I want to be able to display the entire post when click on each post. Do you have to pass a new query to the datasource, or do you have to assign some new properties to the object?

I didn't see anything in your datasource tutorial how to do so.
When you say "post" I am assuming you mean a block of root elements from a feed?

The most common way to establish this scenario is to create a class that builds an output that is similar to a complete set of information (image, title, body text, etc.) then within each class you call the pieces of information from the feed that you would like to see. IN some cases this does require that you broaden your query to pull in an entire node or root element that contains all the info you are looking for.

If you want to access a particular item then you can add a param for datasourceindex to your class. this will return the number of items in a feed. From there you can identify if statements and such that can whittle down the feed to the particular items you desire.

This can also be accomplished by using advanced xpathing in your query to only return a subset of the feed. Have you checked out the link from the tutorial on xpathing? http://www.w3schools.com/xpath/xpath_...

Here is an example of datasourceindex in a class: http://content.rarewire.com/wordpress...