Web DevCenter
oreilly.comSafari Books Online.Conferences.
MySQL Conference and Expo April 14-17, 2008, Santa Clara, CA

Sponsored Developer Resources

Web Columns
Adobe GoLive
Essential JavaScript

Web Topics
All Articles
Scripting Languages

Atom 1.0 Feed RSS 1.0 Feed RSS 2.0 Feed

Learning Lab

Understanding Weblogs
Pages: 1, 2

The Gory Details

While you would frequently see the words weblog (or WebBlog) and RSS together, they don't mean exactly the same thing. RSS is a Web content syndication format. What this means, simply, is that you can use RSS to gather news on the Web. Although RSS is commonly used by webloggers, it has wide applications, especially among news agencies such as New York Times, as a mean to distribute their news content.

What Exactly is RSS?

RSS is an application of XML. A RSS document looks like this:

Click for larger view
Figure 9. An RSS document for my weblog (You can click on the image for a full-size view)

If you compare the XML document shown above with my weblog, it's not difficult to see that the RSS document actually contains the content of my blog. It's somewhat similar to the concept of Web services -- while my weblog provides a visually appealing representation of things I want to say, the RSS document contains the actual content of the Web site, without all of the fanciful graphics. This concept is very powerful.

Suppose today you have to visit several Web sites for the latest news. Now, imagine that all these Web sites provide RSS documents describing their content. So all you need to do is to aggregate the various RSS documents and read it in one place -- hence the phrase "News Aggregator." I won't delve into the detailed XML document structure here, but suffice it to say that there is a certain document structure that you need to follow.

A Two-minute History of RSS

RSS went through a number of revisions. There seems to be two camps: RSS 0.91, 0.92, 0.94, and 2.0 versus RSS 1.0.

As this is a religious topic that is fiercely debated, I will steer clear of the trouble here and instead point out some URLs that you can read. You decide for yourself.

Radio UserLand uses RSS 0.92.

Exposing Your Site as RSS

The next question that you may be asking is, "So how do I expose a RSS document on my Web site?"

Of course, the most straightforward answer is to use a blogging tool such as Radio UserLand, which generates the RSS document for you automatically. Besides Radio UserLand, there are a few good syndication and aggregation tools:

These tools automatically help you to create a RSS document describing the content of your site.

If you prefer to create the RSS document by hand, visit the following URL:

Once your RSS document is created, you can now make it available as a link on your Web site for other users to read from it. This process is known as syndication.

Validating Your RSS

Once the RSS document is generated, you'll want to ensure that it conforms to the relevant versionof RSS. If you create the RSS document by hand, then this is even more important for you to do. There are quite a number of RSS validators on the Web. Here are just two of them:

Aggregating RSS Documents

Technically, it's not difficult to gather all of the RSS documents from all of the Web sites exposing them and view the contents on your machine. This process is known as aggregation.

All you need to do is to download all of the RSS documents and send them to a XML parser. You can either write an XSLT (Extensible Stylesheet Language Transformation) stylesheet to transform the XML content into a format that you want (such as HTML for Web browsers or WML for WAP devices), or use DOM (Document Object Model) to retrieve all of the required elements. Unless you have a very good reason to do this (such as integrating the RSS content in your own application), why reinvent the wheel? There's a lot of software on the Net that helps you to repurpose RSS documents so you can view them in one window.

NewsZ Crawler is one such program. It allows you to browse normal Web pages as well as aggregate news from the Web. It also enables reading of NNTP news:

Figure 10. O'Reilly's Meerkat Open Wire Service
Figure 10. O'Reilly's Meerkat Open Wire Service

O'Reilly's Meerkat is also a news aggregator, albeit a Web-based one:

Figure 11. O'Reilly's Meerkat Open Wire Service
Figure 11. O'Reilly's Meerkat Open Wire Service

Even if you want to integrate the RSS content into your Web application, there are tools available to help you do the job. Here are just two of them:

Final Thoughts

Weblogging is a terrific medium for sharing personal observations, as well as formal news. If you have something to say, I encourage you to create your own blog. Otherwise, I hope you continue to enjoy the words of others via this increasingly popular publishing format.


Wei-Meng Lee (Microsoft MVP) http://weimenglee.blogspot.com is a technologist and founder of Developer Learning Solutions http://www.developerlearningsolutions.com, a technology company specializing in hands-on training on the latest Microsoft technologies.

Return to the Web Development DevCenter.