The BDN Guide to RSS - by Craig Stuntz

By: Craig Stuntz

Abstract: A simple introduction to using the BDN RSS feeds and writing applications which produce or consume RSS.

Introduction

BDN now features RSS (Really Simple Syndication) feeds for BDN News, CodeCentral submissions, and QualityCentral reports. This article explains what RSS is, how to use it, and how you can use it in your own applications. If you're already using an RSS aggregator, start by subscribing to the feeds which intrest you, then skip ahead to the section on using RSS in your own applications. If you've never heard of RSS, read on!

RSS for Beginners

The purpose of RSS is to make it easy to find recent content which is interesting to you. Usually "content" means web pages, but, as demonstrated by the CodeCentral and QualityCentral feeds, almost anything which can be described with a paragraph or so of text and a URL is fair game. If you visit several different web sites each day looking for new articles, that can be a fairly time-consuming process. RSS feeds allow you to skim multiple sources for items of interest without having to visit multiple sites.

Most people use RSS feeds by running a program called an aggregator, so named because it combines the information from multiple feeds into a list of recently published items. The easiest way to get the feel for what you can do with RSS feeds is to use an aggregator. Here are a few you might want to try, in alphabetical order:

BlogLines is probably the easiest way to get started as it requires neither a download nor installation, but some people will prefer a Windows client such as FeedDemon. AmphetaDesk's biggest strength is its ease of customization (for those familiar with Perl, anyway).

Once you've picked an aggregator to try, add a feed, such as the feed from my weblog or one of the BDN feeds. When you visit your favorite web sites, look for the little red XML button, like the one on the left-hand side of my weblog. This button means that an RSS feed is available.

The aggregator will download the RSS files from each site you track every hour or so, and combine the feeds for display. You can quickly skim the new items and read the articles which intrest you. This works especially well if you use a browser which supports tabbed browsing, such as Mozilla Firebird, as you can open each interesting article in a new tab as you skim through the list and then close the tabs after you've read each article.

That's really all there is to it. RSS lives up to the "Really Simple" part of its name, at least when it comes to reading feeds with a commercial aggregator. It makes keeping track of what's new on the web and elsewhere easier.

OPML

Outline Processor Markup Language (OPML) is an XML dialect designed to store information in outline or tree-structured form. It's useful in the context of RSS since a number of RSS aggregators use this format to store subscriptions to RSS channels. If your aggregator supports OPML documents you can easily exchange a large number of RSS subscriptions with users of many other aggregators.

You can subscribe to all of the Borland RSS feeds at once using this OPML document.

Programming with RSS

RSS is more or less an XML dialect. I say "more or less" because there is no official XSD for it (although some have tried) and because a number of sites produces RSS that follows the rules of neither RSS nor XML. This means that if your application intends to consume RSS generated by persons unknown in the wilds of the internet, you must be prepared to deal with some less-than-compliant documents. Since non-well-formed documents may be summarily rejected by an off-the-shelf DOM, some authors resort to writing their own parsers.

An additional problem for applications consuming RSS feeds is that there are multiple, not-entirely-compatible versions of the RSS specification. A good aggregator needs to be able to handle all of them.

Producing RSS documents, on the other hand, can be done quite readily with components such as TXMLDocument in Delphi. You can use TXMLDocument directly, but I wrote a simple RSS component in less than half an hour using a sample RSS document, Delphi's XML Data Binding Wizard, and Indy, which makes working with RSS documents much easier. I haven't released it to the public, mostly because Robert MacLean offers a free component which also uses TXMLDocument, but adds more bells and whistles.

For details, such as they are, on how to use each tag in the document, read the RSS 2.0 specification. It's a bit vague in places  for example, it gives conflicting advice on how to use the permalink tag  so when publishing RSS it's a good idea to test your feeds with a variety of popular aggregators.

Sample RSS Projects in CodeCentral

  • From John Moshakis, an ASP.NET application (written in Delphi for .NET) which serves blog entries and includes an RSS feed.
  • From Chris Dickerson, a Delphi for .NET RSS aggregator.

Open Source RSS Projects on SourceForge

  • FeedReader is an open source Windows aggregator.
  • As I mentioned above, Robert MacLean's SimpleRSS component is a Delphi component for consuming and producing RSS feeds.

Alternative Formats

Two other XML dialects are worth menioning: Atom and RDF.

Atom

Atom is an alternative to RSS which was born out of frustration with ambiguities in the RSS specification. Atom is "pre-release" and much less popular than RSS at this point, but still widely supported (although BlogLines and FeedDemon, mentioned above, both support it), and in general places much more emphasis on having an unambiguous and testable standard.

RDF

RDF is a newly-approved W3C standard which attempts a much broader scope than RSS. It's designed to allow cataloging just about anything, anywhere. As such, it's probably a better fit for non-news feeds such as CodeCentral entries, but the specification is brand new and not widely supported yet. Some early versions of RSS were compatible with RSS, but they are now very different and cannot be treated interchangeably.



Server Response from: ETNASC01