On to RSS
Now that you know about elements, attributes, the XML prolog, and comments, let’s review an XML vocabulary that’s been getting a lot of visibility lately—RSS, which stands for Rich Site Summary, Really Simple Syndication, RDF Site Summary, etc. (depends on whom you ask).
You’ve probably seen those little orange XML boxes on web pages (see Figure 1). Those are RSS links. If you click one, you’ll see something like the XML shown in Listing 1. That little box is not there for you to view the XML behind the RSS, but instead to grab the URL and hand it over to an RSS reader. Right-click to get the URL of the site and copy it to your RSS aggregator; left-click and the browser will display the XML to you.
Figure 1 RSS link.
From an XML perspective, an RSS file simply contains a list of items to display to some end user. Usually, each item contains a title, a summary, and a link to a URL (some web page). Other information, such as the date, creator’s name, etc., may also be available. Listing 1 shows some elements and attributes that make up an RSS document. Remember, it’s all XML.
Listing 1 A sample XML-based RSS document.
<rss version="0.91"> <channel> <link>http://www.yaywastaken.com/amazon/</link> <title>Amazon: weblogs</title> <description>Bob’s custom Amazon RSS feed!</description> <language>en-us</language> <item> <link>http://www.amazon.com/exec/obidos/ASIN/047174719X</link> <title>Naked Conversations: How Blogs are Changing the Way Businesses Talk with Customers</title> <description>Author: Robert Scoble; $16.47</description> </item> <item> <link>http://www.amazon.com/exec/obidos/ASIN/1931498997</link> <title>Crashing the Gate: Netroots, Grassroots, and the Rise of People-Powered Politics</title> <description>Author: Jerome Armstrong; $16.50</description> </item> </rss>
In the XML in Listing 1, notice that almost all the data is represented as elements. There is a top-level element called rss and a subelement called channel. In the world of RSS, a collection of links is referred to as a channel, just like the channel you tune into on TV or the radio. In RSS, channels serve to deliver content items in an easily digestible form.
Note also in Listing 1 that our top-level element (<rss>) has an attribute named version, specifying the version number of the RSS we’re reviewing. Because the version can be thought of as metadata, it makes sense that version is an attribute.
Within the RSS world, version matters. In your RSS travels, you may encounter versions 0.90 and 0.91 (created by Netscape), version 1.0 (by RSS-DEV), and 0.9x and 2.0 (by UserLand Software). In practice, almost all applications that handle RSS feeds can deal with all the different versions.
For more details on RSS, check out Bob Reselman’s article "RSS 101." And since you’re already at Informit, check out our new search capability, which can help you locate numerous XML technical articles.