Creating RSS files for your Web site (3/5) - exploring XML | WebReference

Creating RSS files for your Web site (3/5) - exploring XML

Creating RSS files for your Web site

Items

A channel may contain any number of <item>s, each of which links to a story, with an optional description:

<!ELEMENT item (title | link | description)*>
Required <item> sub-elements
<!ELEMENT title (#PCDATA)> the title of the story. Maximum length is 100.
<!ELEMENT link (#PCDATA)> the URL of the story. Maximum length is 500.
Optional <item> sub-elements
<!ELEMENT description (#PCDATA)> the story synopsis. Maximum length is 500.

Images

An <image> is a sub-element of <channel>, which contains three required and three optional sub-elements:

<!ELEMENT image (title | url | link | width? | height? | description?)*>
Required <image> sub-elements
<!ELEMENT url (#PCDATA)> the URL of a GIF, JPEG or PNG image that represents the channel. Maximum length is 500.
<!ELEMENT title (#PCDATA)> describes the image, it's used in the ALT attribute of the HTML <img> tag when the channel is rendered in HTML. Maximum length is 100.

<!ELEMENT link (#PCDATA)> 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>. Maximum length is 500.

Optional <image> sub-elements
<!ELEMENT width (#PCDATA)> the width of the image in pixels. Maximum value is 144, default value is 88.
<!ELEMENT height (#PCDATA)> the height of the image in pixels. Maximum value is 400, default value is 31.
<!ELEMENT description (#PCDATA)> contains text that is included in the TITLE attribute of the link formed around the image in the HTML rendering.

Text Input

A channel may optionally contain a <textInput> sub-element, which contains four required sub-elements:

<!ELEMENT textinput (title | description | name | link)*>
Required <textinput> sub-elements
<!ELEMENT title (#PCDATA)> The label of the Submit button in the text input area. Maximum length is 100.
<!ELEMENT description (#PCDATA)> Explains the text input area. Maximum length is 500.
<!ELEMENT name (#PCDATA)> The name of the text object in the text input area. Maximum length is 20.
<!ELEMENT link (#PCDATA)> The URL of the CGI script that processes text input requests. Maximum length is 500.

Nota bene: RSS 0.91 places restrictions on the first non-whitespace characters of the data in <link> and <url> elements. The data in these elements must begin with http:// or ftp://. Among others, https:, file:, mailto:, news:, and javascript: are not permitted.

Let's look at a full-fledged example.

http://www.internet.com

Produced by Michael Claßen
All Rights Reserved. Legal Notices.

URL: http://www.webreference.com/xml/column13/3.html
Created: Jun 18, 2000
Revised: Jun 18, 2000