[ Team LiB ] |
6.2 The Specification in DetailThis section is based on the RSS 1.0 Specification, Version 1.3.4, dated 30 May 2001. The full document is available at http://purl.org/rss/1.0/spec. 6.2.1 The Basic StructureAs we've seen, RSS 1.0's structure differs from the earlier versions of RSS by bringing the item , image, and textinput elements to the same level as channel. Examples Example 6-2 and Example 6-3 show this difference in their basic structures. Example 6-2. The basic structure of RSS 0.9x<rss> <channel> <image/> <textinput/> <item/> <item/> <item/> </channel> </rss> Example 6-3. The basic structure of RSS 1.0<rdf> <channel/> <image/> <textinput/> <item/> <item/> <item/> </rdf> This difference both results from, and necessitates, the use of RDF notation to define the relationships between the elements. 6.2.2 The Root ElementThe root element of an RSS 1.0 document is always built upon this line: <rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> Any additional namespace declarations are inserted within this line. When designing your feed, and again after creating it, it is worth checking that all the namespaces you have used have been declared in the root element. 6.2.3 <channel rdf:about=""> (a Subelement of rdf:RDF)The next level begins with the required channel element. This element must look like this: <channel rdf:about="URI THAT IDENTIFIES THE CHANNEL"> subelements here </content> The contents of the rdf:about attribute must represent the feed itself. The specification states that this may be either the URL of the feed itself or the URL of the site it represents. Common usage seems to favor the URL of the feed itself � i.e., the URI. 6.2.3.1 Required subelements of channelchannel can contain many subelements. The additional modules, detailed in Chapter 7, define about 30 optional additions to these core subelements:
The following elements are required only if the feed contains the objects to which they refer. RSS 1.0 does not require an image, text input, or even any items to be present. However, the feed will be very dull indeed without at least one of these elements:
6.2.4 <image rdf:resource=""> (a Subelement of rdf:RDF)Unlike RSS 0.9x, there is no requirement for an image to be associated with an RSS 1.0 feed. This is because RSS 1.0 is not restricted to uses that involve plain-and-simple parsing into HTML. Mandating an image would be superfluous on these occasions. Nevertheless, image is still used a great deal. According to the specification, "this image should be of a format supported by the majority of web browsers. While the later 0.91 specification allowed for a width of 1-144 and height of 1-400, convention (and the 0.9 specification) dictate 88 x 31." This element takes the rdf:resource attribute. This attribute should be the URL of the image file, and it should be mirrored within the image subelement of channel. The element also takes three mandatory subelements, in addition to the optional subelements available through the modules that we will discuss in Chapter 7. The mandatory subelements are:
6.2.5 <textinput rdf:about=""> (a Subelement of rdf:RDF)This element, like its RSS 0.9x counterpart, provides a method of describing a form of input for delivering data to a URL that can deal with an HTTP GET request (a CGI script, for example). It's entirely optional, however, as the specification states:
Nevertheless, it is still used. It takes an rdf:about attribute, which should point to the URL contained within its own link subelement, and requires four mandatory subelements:
6.2.6 <item rdf:about=""> (a Subelement of rdf:RDF)The item subelement is where the real work gets done. Like its RSS 0.9x namesake, the item subelement contains the details of each of the URLs listed within the feed, along with metadata, description, and so on. Unlike RSS 0.9x, however, RSS 1.0's item can point to many different things � basically anything that can be represented by a URL, even if it is not an ordinary page. Because of this capability, the item subelement is the one most affected by the use of optional modules. We'll deal with those in Chapter 7, so for now we'll look at its own core subelements:
|
[ Team LiB ] |