Hack 81 Create an RSS 0.91 Document

figs/beginner.gif figs/hack81.gif

Create an RSS 0.91 document using a template, and gain a little essential background in RSS history.

RSS 0.91 is probably the most popular RSS format because it is the oldest and is so simple, which, as with so many other technologies, encourages adoption by the teeming masses. Here is a minimal 0.91 document, containing all the required elements and a few optional ones (it is named news.xml in the file archive):

<rss version="0.91">


  <title>Wy'east Communications</title>


  <description> Wy'east Communications is an XML 









   <title>Legend of Wy'east</title>


   <description>The Native American story behind the name





RSS 0.91 doesn't declare a namespace for its elements. The rss element is the document element. It has a required attribute, version, whose value is 0.91. This element must have exactly one channel child and one or more item children. Following the channel element are these elements:


A descriptive title for this channel. This should usually be the same as the content of the HTML element title on your main site page (such as index.html). The maximum number of characters allowed here is 100.


A URI for the channel. This should be a link to the web site that originates the feed?in this case, http://www.wyeast.net. Maximum length of this element is 500 characters.


A description of the channel, usually answering the question "What's this site all about?" Limited to 500 characters.

For a comparison of the required and optional child elements of channel for both RSS 0.91 and 2.0, see Table 6-2 in [Hack #83] .

The image is an optional element that has three required child elements: url, which contains a URL for a JPG, GIF, or PNG image representing the channel (500 character limit); title, which contains the alt attribute value from the img element in HTML used for the graphic whose link is in url (100 character limit); and link, a link to the web site represented by the link in url. The elements title and link should have the same content as the elements with the same names that are children of channel (500 character limit).

RSS 0.91 requires the first non-whitespace characters of the content in link and url elements to begin with ftp:// or http://. Others are not permitted. This restriction is lifted by RSS 2.0 [Hack #83] .

The optional children of image are description, width, and height. description should contain the same advisory text as might be found in the title attribute on the a element that creates the link associated with the graphic; width and height are the width and height of the graphic. By default, the value of width is 88 with a max of 144; the default value of height is 31 with a max of 400.

This document has only one item element, though it is common to have several (you can only have up to 15 in RSS 0.91 according to http://blogs.law.harvard.edu/tech/rss#comments). A channel element may have one or more item children, which can contain: title, the title of the article or story (100 character limit); link, the URL to the story (500 character limit); and description, which holds a summary of the article or story (500 character limit).

You can find a DTD for RSS 0.91 at http://my.netscape.com/publish/formats/rss-0.91.dtd.

Other optional children of channel are shown in Table 6-1. For more information on these and other RSS 0.91 elements, see http://backend.userland.com/rss091.

Table 6-1. Optional children of channel in RSS 0.91




Copyright notice for the channel


Documentation for the RSS format used by the channel


Last time channel content changed, in RFC 822 format, Sat, 01 Jan 05 00:00:27 PST (see http://www.ietf.org/rfc/rfc822.txt)


Email address of managing editor for the channel


Publication date of channel, in RFC 822 format, Sat, 01 Jan 05 00:00:27 PST (see http://www.ietf.org/rfc/rfc822.txt)


Platform for Internet Content Selection (PICS) rating (http://www.w3.org/PICS/)


Days to skip reading channel


Hours to skip reading channel


A text input box for the channel, such as a search box (required children include title, description, name, and link)


Email address of webmaster for the channel