Home > Guides > Programming > .NET and Windows Programming

Toggle Open Guide Table of ContentsGuide Contents

Close Table of ContentsGuide Contents

Close Table of Contents

RSS

Last updated Jan 6, 2005.

The original meaning of the acronym RSS was Really Simple Syndication. It described an XML format for publishing Web site summaries. The idea was to publish a summary of a Web site's contents in a small XML document that users could download and view. After viewing the summary, the user could choose to view the entire site. This format was (and is) especially useful for viewing summaries of news articles and other content (like blogs) that changes quickly.

RSS became very popular with the explosion of blogging beginning in late 1999 or 2000. By then, the format had been extended in several ways, and two competing and almost compatible formats had emerged. Those formats are commonly referred to as RSS 2.0 (http://blogs.law.harvard.edu/tech/rss) and RDF, or RSS 1.0 (http://web.resource.org/rss/1.0/spec). RSS 2.0 is the format defined by the original author and frozen at version 2.0. The author will not be extending that format. RDF is very similar to RSS, and continues to be developed. There is much bad blood between the two camps.

Atom (http://www.atomenabled.org/developers/syndication/atom-format-spec.php) is a new format, still in development but widely used, that is an attempt to unify the camps and provide a single syndication format for the Web. It is gaining ground, but it's likely that many sites will continue to use RSS or RDF for some time to come.

Having three different formats makes for some interesting problems, not only for publishers who want to reach the widest possible audience, but also for those of us who want to write programs that will read the site summaries.

A typical RSS feed

An RSS feed is a simple XML document that consists of a header (channel) and one or more items. The items are usually HTML summaries (teasers) of articles that are on the associated Web site, although many feeds include the entire article. For example, here's a subset of the RSS feed for the .NET Reference Guide:

<rss version="0.91">
 <channel>
  <title>InformIT :: .NET Reference Guide</title>

  <link>http://www.informit.com</link>
  <description>The latest weblog and content updates for the InformIT-.NET Reference Guide</description>
  <language>en-us</language>
  <copyright>Copyright 2004 Pearson Education, Inc. InformIT Division.</copyright>

  <item>
   <title>Blog :: String comparison madness</title>
   <link>http://www.informit.com/discussion/index.asp?postid=8b937bcf-0c95-430b-bafe-b8bdd5606f89&amp;f1=rss</link>
  </item>

  <item>
   <title>Blog :: Updating a table through a DataView</title>
   <link>http://www.informit.com/discussion/index.asp?postid=b78802ea-a746-4c5c-a1da-a02bad83c31d&amp;f1=rss</link>

  </item>

  <item>
   <title>Blog :: Upcoming Visual Basic language changes</title>
   <link>http://www.informit.com/discussion/index.asp?postid=71c39b98-2251-4531-9847-d0fb62b502e0&amp;f1=rss</link>
  </item>

 </channel>
</rss>

This is an RSS 0.91 feed, which is compatible with RSS 2.0. The items in this feed contain only the title and a link to the full article. Items in other feeds will include a date and also a description, which is the article or article summary. For an example, here's an extract of the feed for my personal blog:

<rss version="2.0">
 <channel>
  <title>Jim Mischel</title>

  <link>http://www.mischel.com</link>
  <description>Jim Mischel's Personal Web Site</description>
  <pubDate>Sun, 02 Jan 2005 12:14:33 CDT</pubDate>
  <language>en-us</language>

  <copyright>Copyright 1997-2004, Jim Mischel.</copyright>
  <managingEditor>jim@mischel.com</managingEditor>
  <webMaster>jim@mischel.com</webMaster>
  <item>

   <title>Final century of the year</title>
   <link>http://www.mischel.com/diary/2004/12/31.htm</link>
   <pubDate>Fri, 31 Dec 2004 15:26:11 CDT</pubDate>
   <description>

    <![CDATA[<p>In keeping with my recently acquired habit of putting things off to the last possible minute, today I completed my last century ride of the year.&nbsp; As I mentioned previously, I set a goal at the beginning of the year to do at least one century ride per month.&nbsp; Today's ride, difficult as it was, completed that.&nbsp; I haven't been training much since October, so I struggled through the ride.</p>
    <p>All told, I made 14 century rides over the year:&nbsp; one each month, with two extra in March.&nbsp; The longest ride was 136 miles (first day of <a href="http://www.mischel.com/mma/skiride2004/index.htm">my trip to Harlingen</a> in March), and the shortest was 98 miles (the last day of the trip).</p>

    <p>Just for the record, I won't be making that commitment next year although I will be training for another ride to Harlingen.&nbsp; This time I'll have more company:&nbsp; possibly a half dozen people making the full ride with me, and a dozen or more making the last day.&nbsp; It should prove interesting.</p>]]>
   </description>
  </item>

 </channel>
</rss>

This, too, is an RSS format document. The Atom format is similar, although it differs in the particulars.

Creating and reading RSS feeds in .NET

Creating an RSS feed in a .NET program is pretty easy: just create a new XML document and then build the feed in the document. That works great if all you want is to publish some information to the Web. Reading feeds, too, is quite easy, although parsing out the individual fields is quite tedious. Still, if you have very simple needs, the low-budget approach of using the .NET Framework's XmlDocument class is sufficient.

If you want to manipulate RSS feeds and items, though, you need to create a full-blown .NET class. Things get trickier in a hurry. When I started working with syndication formats, I started writing my own RSS and Atom formats, but soon found myself bogged down in the details of the classes rather than in the details of what I wanted to do with the information. At that point I started searching for alternatives.

There are many different RSS and Atom class libraries available to .NET programmers. Most of them are written in C#, and they vary in their capabilities and quality. After quite a bit of research, I've settled on two class libraries, both free and written in C#, that appear to be quite good although certainly not flawless: RSS.NET and Atom.NET.

Discussions

Copies of the array?
Posted Dec 23, 2008 03:40 PM by luige21
1 Replies
Hi
Posted Dec 5, 2008 05:10 AM by ajay2000bhushan
2 Replies
You have no clue.
Posted Jun 10, 2008 03:28 PM by theinternetmaster
1 Replies

Make a New Comment

You must log in in order to post a comment.

Related Resources

Jim Mischel"Highly unlikely" does not mean "impossible"
By Jim MischelJuly 18, 2009 No Comments

One of my programs crashed the other day in a very unexpected place.  A call to System.Threading.ConcurrentQueue.TryDequeue (from the Parallel Extensions to .NET) resulted in an OverflowException being thrown.  Investigation revealed a pretty serious bug in the System.Random constructor.

It's Here; Put Away Your Pre-Conceptions on What an OS Must Be: Part II
By John TraenkenschuhMay 24, 2009 No Comments

In the last blog in this series, Traenk relates his first experiences with computers and with coding.  But now, some years have passed. . .

It's Here; Put Away Your Pre-Conceptions on What an OS Must Be: Part I
By John TraenkenschuhMay 24, 2009 No Comments

Traenk relates his past experience with Operating Systems that goes back 25 years, ok, more than that but he ain't tellin'

See More Blogs

Informit Network