Click here to Skip to main content
15,176,561 members
Articles / Programming Languages / C#
Posted 15 Jan 2006


47 bookmarked

Simple RSS

Rate me:
Please Sign up or sign in to vote.
3.65/5 (13 votes)
15 Jan 2006CPOL2 min read
Build your own RSS reader with a couple of easy-to-use classes!

What is it?

SimpleRss in action This article describes a simple RSS reader built on a couple of classes, RSSChannel and RSSItem. For an introduction to , please see this Wikipedia article.

You use the reader by selecting a channel, clicking "Update" to retrieve the latest articles, selecting an entry in the article list, and clicking "View" to the view the article. The article is displayed in a new IE window.

Click here for an animated view

How it works

The reader is based on a couple of classes, RSSChannel and RSSItem. RSSChannel encapsulates an RSS feed while RSSItem represents individual items in the feed. Retrieving a feed is as easy as constructing an RSSChannel and calling fetchItems().

// Create the channel and fetch its items
RSSChannel channel =
  new RSSChannel ("ABC News - International",

The collection of articles is retrieved via the channel's Items property. Each article is an instance of an RSSItem object and exposes a few commonly used attributes such as the article title, description, URL, author and publication timestamp.

// Print titles of retrieved articles
foreach (RSSItem rssItem in channel.Items)
    Console.Writeln (rssItem.Title);

RSSChannel works by downloading and parsing the content made available at the channel URL. All the "heavy lifting" is done by the WebResourceProvider and StringParser classes, described elsewhere at CodeProject.


RSSChannel works by downloading the content offered by the RSS feed, parsing the XML document, and extracting the channel's title, publication timestamp and collection of items. The base WebResourceProvider class takes care of the task of retrieving the content and calls RSSChannel's parseContent() override, which does the following:

  1. Get the <rss> element - fail if none.
  2. Get the value of the contained <channel> element - fail if none.
  3. Get the value of the contained <title> element - fail if none.
  4. Get the value of the optional <pubDate> or <lastBuildDate> element.
  5. Construct an RSSItem from every contained <item> element.

RSSChannel exposes the following properties:

Items Gets the collection of articles (RSSItems) in the channel.
Name Gets and sets the channel's name.
Title Gets the channel's title.
Updated Gets the channel's updated timestamp.

RSSChannel also contains other properties (and methods) inherited from the WebResourceProvider class from which it derives.


RSSItem represents a single item (i.e. article) in the RSSChannel and works by constructing itself from an <item> element present contained within the feed's <channel> element. See this link for a complete list of sub-elements contained within <item>.

RSSItem exposes the following properties:

Author Gets the article's author.
Description Gets the article's description.
Link Gets the article URL.
Published Gets the article's publication time.
PublishedAsString Gets the article's publication timestamp as a string.
Title Gets the article's title.

Revision History

  • 15 Jan 2006
    Initial version.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Ravi Bhavnani
Technical Lead
Canada Canada
Ravi Bhavnani is an ardent fan of Microsoft technologies who loves building Windows apps, especially PIMs, system utilities, and things that go bump on the Internet. During his career, Ravi has developed expert systems, desktop imaging apps, marketing automation software, EDA tools, a platform to help people find, analyze and understand information, trading software for institutional investors and advanced data visualization solutions. He currently works for a company that provides enterprise workforce management solutions to large clients.

His interests include the .NET framework, reasoning systems, financial analysis and algorithmic trading, NLP, HCI and UI design. Ravi holds a BS in Physics and Math and an MS in Computer Science and was a Microsoft MVP (C++ and C# in 2006 and 2007). He is also the co-inventor of 3 patents on software security and generating data visualization dashboards. His claim to fame is that he crafted CodeProject's "joke" forum post icon.

Ravi's biggest fear is that one day he might actually get a life, although the chances of that happening seem extremely remote.

Comments and Discussions

GeneralThanks Pin
Hemant.Kamalakar29-Dec-07 0:53
MemberHemant.Kamalakar29-Dec-07 0:53 
GeneralRe: Thanks Pin
Ravi Bhavnani29-Dec-07 5:17
professionalRavi Bhavnani29-Dec-07 5:17 
QuestionProxy Authentication Pin
Shishir Pandey30-Nov-06 17:57
MemberShishir Pandey30-Nov-06 17:57 
AnswerRe: Proxy Authentication Pin
Ravi Bhavnani1-Dec-06 9:17
professionalRavi Bhavnani1-Dec-06 9:17 
GeneralRe: Proxy Authentication Pin
Shishir Pandey4-Dec-06 23:59
MemberShishir Pandey4-Dec-06 23:59 
QuestionCharacter set (french) Pin
mwa_lux14-Apr-06 13:27
Membermwa_lux14-Apr-06 13:27 
AnswerRe: Character set (french) Pin
Ravi Bhavnani14-Apr-06 13:40
professionalRavi Bhavnani14-Apr-06 13:40 
AnswerAh! Pin
Ravi Bhavnani14-Apr-06 15:01
professionalRavi Bhavnani14-Apr-06 15:01 
AnswerRe: Ah! Pin
mwa_lux15-Apr-06 10:58
Membermwa_lux15-Apr-06 10:58 
GeneralThanks for Thanks Pin
realhossam29-Mar-06 4:31
Memberrealhossam29-Mar-06 4:31 
Generalyour attentionThanks for Thanks Pin
realhossam29-Mar-06 4:30
Memberrealhossam29-Mar-06 4:30 
GeneralMissing 'SimpleRSSDemoForm.resx' Pin
BDisp22-Jan-06 1:32
MemberBDisp22-Jan-06 1:32 
GeneralRe: Missing 'SimpleRSSDemoForm.resx' Pin
BDisp22-Jan-06 1:59
MemberBDisp22-Jan-06 1:59 
GeneralRe: Missing 'SimpleRSSDemoForm.resx' Pin
Ravi Bhavnani22-Jan-06 5:49
professionalRavi Bhavnani22-Jan-06 5:49 
GeneralRe: Missing 'SimpleRSSDemoForm.resx' Pin
Ravi Bhavnani24-Jan-06 12:10
professionalRavi Bhavnani24-Jan-06 12:10 
GeneralNo Article Pin
Matthew Hazlett15-Jan-06 19:35
MemberMatthew Hazlett15-Jan-06 19:35 
GeneralRe: No Article Pin
Ravi Bhavnani16-Jan-06 6:43
professionalRavi Bhavnani16-Jan-06 6:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.