[ Team LiB ] |
8.1 The Specification in DetailRSS 2.0 is basically RSS 0.92 with modules allowed and a handful of additional elements. There are also a small number of rule changes, but we will deal with the new elements first:
All of these new elements are quite straightforward, with the exception of guid. This requires some more examination. 8.1.1 When a guid Is Not a GUIDThe introduction of the guid element caused many people to comment on its ability to cause confusion among users. There is already a concept known as GUID, whose letters stand for the same thing�Globally Unique Identifier. The idea behind both guid and GUID is that by giving an object a unique string to identify it, we allow RSS-reading applications to record which item it has already seen. A guid is used�instead of relying on the link URL, for example�because we can both ensure that the guid (and hence the item) is uniquely identified (URLs can be reused), and because programmatically it is easier and quicker to distinguish between two simple strings than it is to use any other method. guid differs from standard GUIDs in that within RSS 2.0 the guid can take any form. It is up to the feed publisher to ensure that the guid is globally unique, whereas the more standard GUID � as defined by the Open Software Foundation � is always a 16-byte integer generated by the OSF GUID algorithm, which takes into account the space and time you are in at the time of its generation. There is nothing to stop you from using that algorithm within your generation of RSS 2.0 feeds, but despite the name you must not assume the guid of another's feed is globally unique. We will discuss implementation of the guid in the next few pages. 8.1.2 Changes from RSS 0.92Other than the new elements and the introduction of namespaced modules within 2.0, there are only five other changes from the 0.92 specification:
Example 8-1 illustrates these changes in a sample RSS 2.0 feed with no modules. Example 8-1. An RSS 2.0 feed with no modules included<?xml version="1.0"?> <rss version="2.0"> <channel> <title>RSS2.0Example</title> <link>http://www.exampleurl.com/example/index.html</link> <description>This is an example RSS 2.0 feed</description> <language>en-gb</language> <copyright>Copyright 2002, Oreilly and Associates.</copyright> <managingEditor>[email protected]</managingEditor> <webMaster>[email protected]</webMaster> <rating> </rating> <pubDate>03 Apr 02 1500 GMT</pubDate> <lastBuildDate>03 Apr 02 1500 GMT</lastBuildDate> <docs>http://backend.userland.com/rss</docs> <skipDays><day>Monday</day></skipDays> <skipHours><hour>20</hour></skipHours> <category domain="http://www.dmoz.org">Business/Industries/Publishing/Publishers/ Nonfiction/Business/O'Reilly_and_Associates/</category> <generator>NewsAggregator'o'Matic</generator> <ttl>30<ttl> <cloud domain="http://www.exampleurl.com" port="80" path="/RPC2" registerProcedure="pleaseNotify" protocol="XML-RPC" /> <image> <title>RSS2.0 Example</title> <url>http://www.exampleurl.com/example/images/logo.gif</url> <link>http://www.exampleurl.com/example/index.html</link> <width>88</width> <height>31</height> <description>The World's Leading Technical Publisher</description> </image> <textInput> <title>Search</title> <description>Search the Archives</description> <name>query</name> <link>http://www.exampleurl.com/example/search.cgi</link> </textInput> <item> <title>The First Item</title> <link>http://www.exampleurl.com/example/001.html</link> <description>This is the first item.</description> <source url="http://www.anothersite.com/index.xml">Another Site</source> <enclosure url="http://www.exampleurl.com/example/001.mp3" length="543210" type"audio/ mpeg"/> <category domain="http://www.dmoz.org">Business/Industries/Publishing/Publishers/ Nonfiction/Business/O'Reilly_and_Associates/</category> <comments>http://www.exampleurl.com/comments/001.html</comments> <author>Ben Hammersley</author> <pubDate>Sat, 01 Jan 2002 0:00:01 GMT</pubDate> <guid isPermaLink="true">http://www.exampleurl.com/example/001.html</guid> </item> <item> <title>The Second Item</title> <link>http://www.exampleurl.com/example/002.html</link> <description>This is the second item.</description> <source url="http://www.anothersite.com/index.xml">Another Site</source> <enclosure url="http://www.exampleurl.com/example/002.mp3" length="543210" type"audio/ mpeg"/> <category domain="http://www.dmoz.org">Business/Industries/Publishing/Publishers/ Nonfiction/Business/O'Reilly_and_Associates/</category> <comments>http://www.exampleurl.com/comments/002.html</comments> <author>Ben Hammersley</author> <pubDate>Sun, 02 Jan 2002 0:00:01 GMT</pubDate> <guid isPermaLink="true">http://www.exampleurl.com/example/002.html</guid> </item> <item> <title>The Third Item</title> <link>http://www.exampleurl.com/example/003.html</link> <description>This is the third item.</description> <source url="http://www.anothersite.com/index.xml">Another Site</source> <enclosure url="http://www.exampleurl.com/example/003.mp3" length="543210" type"audio/ mpeg"/> <category domain="http://www.dmoz.org">Business/Industries/Publishing/Publishers/ Nonfiction/Business/O'Reilly_and_Associates/</category> <comments>http://www.exampleurl.com/comments/003.html</comments> <author>Ben Hammersley</author> <pubDate>Mon, 03 Jan 2002 0:00:01 GMT</pubDate> <guid isPermaLink="true">http://www.exampleurl.com/example/003.html</guid> </item> </channel> </rss> |
[ Team LiB ] |