The RSS Format

Root Element

The exact format of an RSS feed varies from version to version. Most have a root node named 'rss' containing an attribute named 'version':


<rss version="0.91">
	...
</rss>

Some use an alternate format named RDF (Resource Definition Language):


<rdf:RDF 
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns="http://purl.org/rss/1.0/">
	...
</rdf:RDF> 

Channel Element

The root node typically contains a single child node named 'channel'. A channel is the basic unit of an RSS feed. It is the container for a collection of articles:


<rss version="0.91">
	<channel>
		...
	</channel>
</rss>

A channel node is required to have at least three child elements:

  • title - the name of the channel
  • link - a link to the channel contents
  • description - a short description of the channel contents


<rss version="0.91">
	<channel>
		<title>BBC News | Technology | UK Edition</title>
		<link>http://news.bbc.co.uk/go/click/rss/0.91/public/-/1/hi/technology/default.stm</link>
		<description>Updated every minute of every day - 
		FOR PERSONAL USE ONLY</description>
	</channel>
</rss>

A number of optional channel elements can be included, such as 'language' and 'copyright'.


<rss version="0.91">
	<channel>
		<title>BBC News | Technology | UK Edition</title>
		<link>http://news.bbc.co.uk/go/click/rss/0.91/public/-/1/hi/technology/default.stm</link>
		<description>Updated every minute of every day - 
		FOR PERSONAL USE ONLY</description>
		<language>en-us</language>
		<copyright>BBC News 2004</copyright>
	</channel>
</rss>

Item Element

A channel also includes a collection of 'item' elements. Items can be either children or siblings of a channel.

Each item describes a single unit of syndicated content:


<rss version="0.91">
	<channel>
		<title>BBC News | Technology | UK Edition</title>
		<link>http://news.bbc.co.uk/go/click/rss/0.91/public/-/1/hi/technology/default.stm</link>
		<description>Updated every minute of every day - 
		FOR PERSONAL USE ONLY</description>
	</channel>
	<item>
		...
	</item>
	<item>
		...
	</item>
</rss>

An item element must contain at least one 'title' or 'description' element. It is most common, however, to see 'title', 'link', and 'description'.


<rss version="0.91">
	<channel>
		<title>BBC News | Technology | UK Edition</title>
		<link>http://news.bbc.co.uk/go/click/rss/0.91/public/-/1/hi/technology/default.stm</link>
		<description>Updated every minute of every day - 
		FOR PERSONAL USE ONLY</description>
	</channel>
	<item>
		<title>UK military denies ban on iPods</title>
		<description>The MOD has denied reports that it has banned Apple's iPod 
		due to fears it could be used to steal files.</description>
		<link>http://news.bbc.co.uk/go/click/rss/0.91/public/-/1/hi/technology/3891421.stm</link>
	</item>
	<item>
		<title>Windows update hits a new delay</title>
		<description>A major update to the Windows XP operating system will be 
		available from August, later than expected.</description>
		<link>http://news.bbc.co.uk/go/click/rss/0.91/public/-/1/hi/technology/3889353.stm</link>
	</item>
</rss>


Documentation generated by ClassyDoc, using the DOMIT! and SAXY parsers.
Please visit Engage Interactive to download free copies.