A study on RSS - Part 2: The RSS format

In the last article I made a simple introduction to what is an RSS Feed and showed the path to creating XML files in PHP. Now it’s time to explain the RSS file structure along with some basic history.

The RSS format was not the first to be used in site summaries, in 1997 the Channel Definition Format created by Microsoft showed up along other less know formats, but it wasn’t until RSS that one specific format became largely popular and used by the “masses”. The first RSS version, known as RDF Site Summary, was created by Dan Libby in 1999 to be used in Netscape’s portal. This format became known as RSS 0.9 and was followed by RSS 0.91, based on alteration proposed by public opinion.

Around that time, due to Netscape’s lack of interest for the standard, a battle for its ownership started, causing what is now called the RSS Fork. Making a long story short, Dave Winer kept the 0.91 line going and a workgroup elaborated RSS 1.0 published by Tristan Louis in 2000. This standard had a more modular structure but was still RDF based.

Dave Winer insisted on RSS 0.91 and after some bumps and turbulence finally published RSS 2.0 in 2002, renaming it to Really Simple Sindication. This version got rid of RDF standards and made code syntax much more simple. Another format, Atom, also appeared in 2003, strutting as its differential the fact that a big corporation (IETF) was behind the scenes looking for evolution since RSS 2.0 was frozen in time.

The dispute between RSS 2.0 and Atom still persists, so for this article I made a choice to implement the RSS 2.0 format, as it’s the format used in my blog’s feeds and in the RSS I implemented over at ComuniWEB.

RSS 2.0

This is the basic structure of a RSS 2.0 file:

 < ?xml version="1.0"?> Liftoff News http://liftoff.msfc.nasa.gov/ Liftoff to Space Exploration.

Star City http://liftoff.msfc.nasa.gov/news/ 2003/news-starcity.asp How do Americans get ready to work with Russians aboard the International Space Station? They take a crash course in culture, language and protocol at Russia's Star City. Space Exploration http://liftoff.msfc.nasa.gov/ Sky watchers in Europe, Asia, and parts of Alaska and Canada will experience a partial eclipse of the Sun on Saturday, May 31st. The Engine That Does More http://liftoff.msfc.nasa.gov/news/ 2003/news-VASIMR.asp Before man travels to Mars, NASA hopes to design new engines that will let us fly through the Solar System more quickly. The proposed VASIMR engine would do that.

Notice the structure has a xml declaration and a “rss” root element. Under the rss element we have a “channel” which in a newspaper would be like the editorials: sports, politics,… Next up the items, this would represent the articles themselves.

Channel node

 Liftoff News http://liftoff.msfc.nasa.gov/ Liftoff to Space Exploration. en-us Tue, 10 Jun 2003 04:00:00 GMT Tue, 10 Jun 2003 09:41:01 GMT http://blogs.law.harvard.edu/tech/rss Weblog Editor 2.0 [email protected] [email protected] 

This node has required fields (3) and optional information, I’ll keep myself to the important ones:


  • Title: Channels title, ex: ComuniWEB – Last Minute
  • Link: URL to the parent site
  • Description: Simple description of the feed and its content

Optional: Language: Language of content “pt-br,en-us,…” Ttl: “time to live”, determines the time to renew a feed’s cache

To find out about more sub-nodes visit the RSS 2.0 specification

Item node

 The Engine That Does More http://liftoff.msfc.nasa.gov/news/2003/news-VASIMR.asp Before man travels to Mars, NASA hopes to design new engines that will let us fly through the Solar System more quickly. The proposed VASIMR engine would do that. Tue, 27 May 2003 08:37:32 GMT http://liftoff.msfc.nasa.gov/2003/05/27.html#item571 

This is the key node to a RSS feed, it represents all the tiny pieces of information that will be shared, be it an article, an event’s information, comments, or any other type of info. This node has a different policy with its sub-nodes, it has to have at least one of theses elements: title, link, description.

Here the link element points to the actual article, not just the site, the other fields are straightforward:

  • author: Author of the item, credits
  • category: identifies a category and may have a “domain” attribute, that points to the URL that lists all in tat category.
  • comments: URL that points to the coment page
  • enclousure: allows external medias to be attached, like images, mp3, etc…
  • guid: item’s unique identifier
  • pubDate: date of publicationin this format: Sun, 19 May 2002 15:21:36 GMT
  • source: link back to the original RSS

So thats the rundown on a RSS 2.0 file structure, it shows itself flexible enough to be used with different content types, making it adjustable to the type you wish to provide. Hope I shined some more light on the subject and this article pleases all you readers like the first part did, by the way thnx for the diggs!

Next time around, in part 3, I’ll wrap this up combining all we have discussed and publishing the feed.

Part 1: What is RSS and how do I build and XML using XML DOM?

comments powered by Disqus

Related Posts

php|tek09 Day #4

php|tek09 Day #4

  • May 25, 2009

And so comes the final day of the 2009 php|tek conference.

Read More
strtotime() - is it useful?

strtotime() - is it useful?

  • September 15, 2006

Every now and then I get e-mails with questions that ask “How can I add X days to a given date?”, “How can I figure the day that corresponds to next thursday?”, and others along the same line. It scares me when I see replies that include enormous codes that execute innumerous function even including some bizarre leap year determination algorithms, I just can’t understand why all the complication and fuss.

The strtotime() function exists to solve these problems and i plan to introduce you to it and show a few usage examples. Also I’m going to check function performance using a simples benchmark comparison.

Read More
Palestra na PHPConf 2008

Palestra na PHPConf 2008

  • November 17, 2008

A convite da iMasters estarei presente novamente este ano na PHPConference 2008 que acontecerá nos dias 27, 28 e 29 de novembro.

Read More