Question

This could be weird, Have you ever come across a blog which you wanted to read in the chronological order? And that blog could be old, with several hundred posts. When i add this feed to my feed reader, say googlereader, the latest feed comes on top and as i scroll down further, the older posts appear. This could be frustrating if you want to read it from the beginning. Is there any reader that does this? Or, i would love to do this as a pet project, (preferably in c#), how exactly should i go about it? Also, are there any .NET libraries which i can use to work on RSS feeds? I have not done any RSS feed programming before.

EDIT I would like to know if there are any technical limitations to this. This was jsut one interesting problem that I encountered that i thought could be tackled programmatically.

Was it helpful?

Solution

If you do decide to roll your own C# application to do this, it is very straightforward in the current version of the .NET Framework.

Look for the System.ServiceModel.Syndication namespace. That has classes related to RSS and Atom feeds. I wrote some code recently that generates a feed from a database using these classes, and adds geocodes to the feed items. I had the same problem where i needed to reverse the order of the items in the feed, because my database query returned them in the opposite order I wanted my users to see.

What I did was to simply hold the list of SyndicationItem objects for the feed in my own List<SyndicationItem> data structure until right before I want to write the feed to disk. Then I would do something like this:

private SyndicationFeed m_feed;
private List<SyndicationItem> m_items;

...snip...

m_items.Reverse();
m_feed.Items = m_items;

OTHER TIPS

In Google Reader, when you're reading a feed, there is a "Feed settings..." menu with the options: "Sort by newest", "Sort by oldest".

Folders have the same options under the menu "Folder settings..."

No programming required.

I think you might have trouble with this. Many RSS feeds only keep the latest 10 or so posts, so there would be no way to provide the older data from the feed since the blog started.

In Google Reader, you can have it display the items in a folder (feed) from either Newest to Oldest, or Oldest to Newest. To do this, select the feed, select the "Feed settings" drop down, and select "Sort by oldest". I'm not sure how far back Google Reader goes, but possibly all the way since it first started monitoring the feed.

This should be fairly easy with any language...all you would need to do is read the feed xml into a DOM structure (nearly all languauges including C# have a DomDocument class)

You should then be able to simply loop through the item nodes in reverse order...

see: http://msdn.microsoft.com/en-us/library/ms756177(VS.85).aspx

As other said, depending on the rss feed, you may only get a finite amount of items.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top