AJAX In Action [247]
The channel elements
The channel can be considered to be the header information of the RSS feed. The channel elements tell the user where the RSS feed is coming from, what the title of the document is, when it was last updated, and so on. Only a few items are required by the RSS specification, as shown in table 13.1.
Table 13.1 Channel required elements
Element
Description
Example
description
Phrase describing the channel.
Weird thoughts from Eric’s Head
link
The URL to the HTML website referring to
http://radio.javaranch.com/pascarello
the channel.
title
The name of the channel and how people
Eric’s blog on JavaRanch.com
refer to the service. The name should be
related to the name of the website.
The three required elements in table 13.1 give us the basic information about the RSS feed. The RSS feed’s required elements tell us where the RSS channel is from, what the title of the channel is, and what the channel is about. If we want to obtain other information about the RSS feed, we need to check for optional elements. Licensed to jonathan zheng Reading information from the outside world 507 The RSS feed can contain any number of the optional channel elements. The RSS feed developer can select none, one, or all 16. The optional elements (table 13.2) give us more options to learn about the feed. Table 13.2 Optional channel elements Element Description Example category Specifies which categories the chanProgramming nel belongs to. cloud Allows processes to register with a cloud so they can be notified of updates to the channel, implementing a lightweight publish-subscribe protocol. copyright The copyright notice for the content in Eric Pascarello the channel. docs A URL that points to the documentahttp://backend.userland.com/rss tion for an RSS feed. generator A string that indicates what program Pebble was used to generate the protocol. image Specifies an image that can be dishttp://pebble.soundforge.net/common/ played along with the feed. images/powered-by-pebble.gif language The language the channel is written in. En lastBuildDate The last time the content was changed. managing editor Email address for person who is pascarello@javaranch.com responsible for the editorial content. pubDate The publication date for the content. rating The PICS rating for the channel. See http://www.w3.org/PICS/. skipDays Informs aggregators what days they can skip checking for updates. skipHours Informs aggregators what hours they can skip checking for updates. textInput Specifies a text input box that can be displayed. continued on next page Licensed to jonathan zheng 508 CHAPTER 13 Building stand-alone applications with Ajax Table 13.2 Optional channel elements (continued) Element Description Example ttl Indicates the Time to Live (TTL), or number of minutes the channel can be cached before it is updated. webmaster Email address for the person who is webmaster@javaranch.com responsible for technical issues. Some of the element options include email addresses in case we have problems with the feed’s content or layout. There is also information that explains when the syndication feed is updated. The channel’s required and optional elements describe the content of the RSS feed so that we can determine the characteristics of the feed. Just like the channel, the item elements have optional elements as well. The item elements The RSS feed can contain multiple item elements, similar to the way a newspaper consists of multiple articles. Each item element is required to have at least one of the following two elements: the title or the description. Only one is needed, according