How to create your own RSS Reader - Introduction




What is RSS?



An xml format used for sharing frequently updated content, blogs, news etc which can be displayed on websites or on someones computer/mobile via a rss reader (and some email client software)

It may contain summary of content, providing links to the actual content, or simply contain the actual content.

Various specifications (or formats) are available, but we're mainly going to be focussing on RSS 2.0 - the code should however work with most rss specifications, except the netscape specification (rdf).

Depending on which specification you use, the abbreviation can mean the following:

Really Simple Syndication (RSS 2.0)
RDF Site Summary (RSS 1.0)
Rich Site Summary (RSS 0.91)


The basics

Here is an example of a basic RSS 2.0 feed.

 
<?xml version="1.0"?>
<rss version="2.0">
  <channel>
 
    <title>Some Rss Feed somewhere</title>
    <link>http://somewebsite.com</link>
    <description>Some of our latest content</description>
 
    <item>
      <title>Some title 1</title>
      <link>http://somewebsite.com/somepage1.html</link>
      <description>Some description about this link</description>
    </item>
 
    <item>
      <title>Some title 2</title>
      <link>http://somewebsite.com/somepage2.html</link>
      <description>Some description about this link</description>
    </item>
 
    <item>
      <title>Some title 3</title>
      <link>http://somewebsite.com/somepage3.html</link>
      <description>Some description about this link</description>
    </item>
 
  </channel>
</rss>
 

Brief description of rss elements

Required channel elements

Element Description
title The title of the feed
link A link on a website relating to the feed
description What the feed is all about
Item Elements containing feed items

Optional channel elements

Element Description
language Language the feed is written in.
copyright Copyright notice for content in the feed.
managingEditor Email address for the editor managing the feed.
webMaster Email address for reporting technical issues
pubDate Publication date for the feed.
lastBuildDate Last time the feed changed.
category Specify categories that the feed belongs to.
generator Text indicating the program used to generate the feed.
cloud Implementing a lightweight publish-subscribe protocol for RSS feeds – which (for example) can be used to let the rss reader know when a new feed is available
ttl ttl(time to live) If you're planning to cache rss feeds, you can use this value (in minutes) to obtain how frequent you need to refresh your cache.
image Sets an image that can be displayed with the channel.
textInput Specifies a text input box that can be displayed with the channel.
skipHours Hours that can be skipped.
skipDays Days that can be skipped

Item elements

Element Description
title Title of the item.
link URL of the item.
description Content of the item
author Email address of the author
category Specify categories that the item belongs to.
comments URL of a page for comments relating to the item.
enclosure Describes an attachment that is attached to the item. It contains three attributes, url (location of the attachment), length (size of the attachment in bytes) and type (Mime type)
guid Unique identifier
pubDate Publication date of the item
source The channel that the item came from.

Image Elements

Element Description
title Description of the image, can be used in the alt attribute of the img (x)html element thats potentially rendered along with the feed
url Location of the image
link Same as the link found in the root of the channel element
width / height Optionally you can supply the rss reader with a width and height tag for the image

For more information on tags or specifications, go to http://feedvalidator.org/


Comments

superb sample

Hi dude, Its really amazing.Good work.I appreciate u..





Post comment

Name *
Email
Title
Body *
Security code
*
* Required fields