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:

Required:

  • 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

Semana de Updates na Comunidade PHP

Semana de Updates na Comunidade PHP

  • December 19, 2006

Os últimos dias tem apresentado uma grande movimentação na comunidade PHP, desde o core até os frameworks.

Read More
Screencast: Utilizando o dmsAutocomplete com banco de dados

Screencast: Utilizando o dmsAutocomplete com banco de dados

  • January 10, 2008

Uma das perguntas que mais respondo pelo blog é “Como faço para utilizar o dmsAutocomplete com registros da base de dados?”. Além disso, a muito tempo procuro uma “desculpa” para fazer um screencast. Decidi então juntar estas duas situações e fazer o primeiro screencast da DMS Systems.

No video apresentado neste post vou demonstrar como fazer uma simples adaptação ao script PHP que vem incluído no dmsAutocomplete para que o mesmo busque dentro de uma base de dados e não mais dentro do texto como o exemplo demonstra. Usarei uma base de dados mysql simples e farei as conexões e busca de resultados utilizando as funções básicas do PDO, portanto se não conhecem esta nova camada OO de abstração de conexão com a base de dados, sugiro que procurem sobre, pois ela facilita e organiza bastante o trabalho com base de dados no PHP.

UPDATE: No momento o serviço que hospeda o screencast esta offline, o screencast deve voltar na quinta ou sexta

UPDATE: Screencast no ar novamente

Read More
php|tek09: Day #3

php|tek09: Day #3

  • May 22, 2009

The beeping alarm begun another exciting day at php|tek09. My usual breakfast buddies were around once again for a great meal to start it out right.

Read More