The key change that RSS 2.0 brings is the ability to use modules. As in RSS 1.0, the use of modules is simply a matter of placing the correct namespace declaration into the root element of the feed and then using the namespace elements with the correct prefix. Unlike 1.0, however, 2.0 modules cannot use RDF for any purpose whatsoever. At least, this is the current thinking of Dave Winer, guardian of the specification.
This is currently a matter of debate, over which much more blood will likely be spilled. When the rules over 1.0 and 2.0 module design have been formalized (I will discuss the latest thinking in Chapter 11) we may be able to use 1.0 modules within 2.0. At the moment, alas, this is not recommended, and for the sake of diplomacy we will deal now solely with specialist 2.0 modules. At this time there is only one: BlogChannel.
Designed by Dave Winer only a week after he formalized RSS 2.0, the BlogChannel module allows the inclusion of data used by weblogging applications and, specifically, the newer generation of aggregating and filtering systems.
It consists of three optional elements, all of which are subelements of channel, and has the following namespace declaration:
The elements are:
Contains a literal string that is the URL of an OPML file containing the blogroll for the site. A blogroll is the list of blogs that the blog author habitually reads.
Contains a literal string that is the URL of a site that the blog author recommends the reader visits.
Contains a literal string that is the URL of the OPML file containing the URLs of the RSS feeds to which the blog author is subscribed in her desktop reader.
Example 8-2 shows the beginning of an RSS 2.0 feed using the BlogChannel module.
<?xml version="1.0"?> <rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule"> <channel> <title>RSS2.0Example</title> <link>http://www.exampleurl.com/example/index.html</link> <description>This is an example RSS 2.0 feed</description> <blogChannel:blogRoll>http://www.exampleurl.com/blogroll.opml</blogChannel:blogRoll> <blogChannel:blink>http://www.benhammersley.com</blogChannel:blink> <blogChannel:mySubscriptions>http://www.exampleurl.com/mySubscriptions.opml</blogChannel:mySubscriptions> ...
We will discuss OPML, blogrolls, and subscription lists in Chapter 10. In the meantime, let's look at producing RSS 2.0 feeds.