Building an RSS File - Enhanced RSS Document Structure (
Page 3 of 4 )
Here's an example:
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>The Programmers Site</title>
<link>http://www.thelinker.com</link>
<description>think big</description>
<pubDate>Wed, 05 Apr 2006 23:58:37</pubDate>
<lastBuildDate>Wed, 05 Apr 2006 23:58:38</lastBuildDate>
<language>en-us</language>
<copyright>Copyright 2006, TheSite</copyright>
<webMaster>ad@k.com (John Doe)</webMaster>
<managingEditor>ad@l.com (John Doe)</managingEditor>
<generator>RSS Builder V1.0 2006(c)</generator>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<image>
<title>Site Image</title>
<link>http://www.thelinker.com</link>
<url>http://k.com/thelink.gif</url>
<width>20</width>
<height>20</height>
</image>
<item>
<title>The title of the story here</title>
<link>the link to the story here</link>
<description>The description here
</description>
</item>
</channel>
</rss>
The section in bold is the only difference between a simple version and a enhanced version. The enhanced version makes more information about the creator of the RSS document available to the RSS reader and aggregators. None of this really matters as far as an RSS reader is concerned, as long as the required elements are included.
Take a careful look at the image tag. It has three required tags: title, link and url, and two optional tags: width and height. Table 3 below explains how these tags are used and what they are for.
Table 3:
|
Element |
Description |
Example |
|
title |
describes the image; it's used in the ALT attribute of the HTML <img> tag when the channel is rendered in HTML.
|
RSS Tutorial |
|
link |
is the URL of the site; when the channel is rendered, the image is a link to the site. (Note, in practice the image <title> and <link> should have the same value as the channel's <title> and <link>.
|
http://www.mysite.com/ |
|
url |
is the URL of a GIF, JPEG or PNG image that represents the channel. |
http://www.mysite.com/theimage.gif |
|
width |
Width of the image. Maximum value for width is 144, default value is 88. |
44 |
|
Height |
Height of the image. Maximum value for height is 400, default value is 31. |
45 |