The Haunted House

Sunday, July 22, 2007

C# RSS Feed Generator Library

You can download the MSI installation package from here.


A while ago I wrote a library in C# for creating and saving RSS xml feed files. I recently dusted off this code and gave it a tidyup.

RSS (which stands for "Really Simple Syndication") is a family of web feed formats used to publish frequently updated content such as blog entries, news headlines or podcasts. An RSS document, which is called a "feed", "web feed", or "channel", contains either a summary of content from an associated web site or the full text. RSS makes it possible for people to keep up with their favorite web sites in an automated manner that's easier than checking them manually.

RSS content can be read using software called a "feed reader (such as Outlook 2007)" or an "aggregator." The user subscribes to a feed by entering the feed's link into the reader or by clicking an RSS icon in a browser that initiates the subscription process. The reader checks the user's subscribed feeds regularly for new content, downloading any updates that it finds.

I will not go into the full RSS spec in this post, but you can read about it at this following address : http://cyber.law.harvard.edu/rss/rss.html

The library is very easy to use. The following code shows its use in the most basic form creating an RSS channel and item containing just the mandatory fields.

RssLib rss = new RssLib();
rss.Channel = new Channel("Steves News", "http://www.stevehaunts.net", "Steve news and related bits and
pieces.");

rss.AddItem(new Item("Cat Saved", "A black cat was today saved from a tree."));
rss.SaveRssFeed(Path.GetFullPath("/test.xml"));

The library handles conversion from the .NET DateTime object in to the RFC882 date specification required by the RSS feed specification. The library also handles converting langauge codes into the RFC1766 language specification.

I have included an nUnit test suite with the library containing over 100 unit tests, so if you want to refactor any of the code you can do so with confidence using the unit tests.

The code is written in C# under the .NET2 platform. You will need Visual Studio 2005 to open up the solution file. To run the unit tests you will need nUnit.

You can download the MSI installation package from here.

Labels:

0 Comments:

Post a Comment

<< Home