RSS 2.0: Really Simple Syndication

RSS 2.0 is the latest version of the development tree of RSS. It passes through the UserLand version of RSS 0.91 and RSS 0.92. In common with RSS 0.9x, RSS 1.0 avoids the use of RDF. It seems reasonable to conclude that the avoidance of RDF is partly a result of Dave Winer’s preference for simplicity and his assumption that RSS feeds transmit information of largely transitory interest. As discussed in Chapter 11 “RDF: The Resource Description Framework” of Beginning RSS and Atom Programming (Wrox, 2005, ISBN: 0-7645-7916-9), those who see information feeds as conduits for disposable information don’t see the value of using RDF in a feed, because metadata is unimportant for those developers who see information feeds as containing disposable, transitory information.

The changes in RSS 2.0 from RSS 0.92 are, with one exception, fairly minor. For example, there are a few new elements and a few changes regarding what particular elements should contain. The one substantive change in RSS 2.0 is the use of XML namespaces. Using XML namespaces opens up possibilities for extending RSS 2.0 using modules.

The RSS 2.0 specification is located at http://blogs.law.harvard.edu/tech/rss.

XML Namespaces in RSS 2.0

RSS 2.0 uses the XML namespaces technique specified in the Namespaces in XML recommendation, located at www.w3.org/TR/REC-xml-names/.

Because versions 0.91 and 0.92 of RSS don’t use XML namespaces, all the elements associated with those specifications are, inevitably, not in any XML namespace. Therefore, unlike the situation with RSS 1.0 where a namespace URI is defined, in RSS 2.0 all the RSS elements are in no namespace.

The availability of XML namespaces allows RSS 2.0 documents to use elements from other namespaces, provided that an appropriate namespace declaration has been made. For example, you can use the Dublin Core module described in Chapter 10 “RSS 1.0 Modules” of Beginning RSS and Atom Programming.

New Elements in RSS 2.0

There are several new elements in RSS 2.0. Each is briefly described in the following list. The use of these new elements is described in more detail in the discussion on RSS 2.0 document structure.

  • author:An optional child element of the item element
  • comments: An optional child element of the item element
  • generator: An optional child element of the channel element
  • guid: An optional child element of the item element
  • pubDate: An optional child element of the item element
  • ttl: An optional child element of the channel element

The RSS 2.0 Document Structure

The RSS 2.0 document structure has many similarities to the structure of RSS 0.91 and RSS 0.92 documents.

The rss Element

The rss element is the document element of an RSS 2.0 document. It has a required version attribute with a value of 2.0. Supposedly, RSS 0.91 and 0.92 documents are legal RSS 2.0 documents but they have a different value for the version attribute. In practice this works, despite the different and theoretically illegal values in the version attribute in RSS 0.91 and 0.92 documents, because many aggregators ignore the value in the version attribute.

If you are writing an RSS 2.0 document, the start tag of the rss element should be written as follows:

<rss version="2.0">

You can also write it using single quote marks:

<rss version='2.0'>

The rss element has a single child element, the channel element. All content of the information feed document is contained in the channel element.

Notice that there is no namespace declaration on the preceding rss start tag. For consistency with RSS 0.91 and 0.92, the elements of RSS 2.0 are in no namespace. This has the advantage of backwards compatibility but does mean there is a risk of naming collisions. In practice, the risk of naming collisions is slight because most non-RSS 2.0 elements likely to be found in an RSS 2.0 document are in a namespace, which allows the aggregator or other user agent to distinguish those elements from RSS 2.0 elements.

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read