..


Sponsored Links

2.0 Structure of an RSS file

Article written by Luca Ruggiero
Page 1 of 2

In a previous article we introduced the RSS format , an XML-based, introducing the structure of the standard RSS (which stands for Really Simple Sindacation) for the exchange of information between different Web applications

Let us examine here the RSS format RSS 2.0 or more precisely 2.

It is always a format based on a standard XML structure as that of the feed of news centre-equestre-lepuy.com, available at:

/rss/news.xml

Example of XML format RSS 2

Consider the structure just indicated, semplifichiamola-level code and see every single tag that is the purpose of:






 <? Xml version = "1.0" encoding = "ISO-8859-1"?>







 <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">



 



 <channel>



  



 <title> MioSito.ext - News Online </ title>



  



 <link> http://www.miosito.ext/news/ </ link>



  



 <description> News of the Web MioSito.ext cra </ description>



  



 <language> en </ language>



  



 <lastBuildDate> 01/04/2008 13:06:54 </ lastBuildDate>



  



 <image>



   



 <url> http://www.miosito.ext/logo_news.gif </ url>



    



 <title> MioSito.ext - News Online </ title>



    



 <link> http://www.miosito.ext/news/ </ link>



  



 </ Image>



  



 <item>



   



 <title> <! [CDATA [Title of the news ]]></ title>



   



 <link> http://www.miosito.ext/notizia.asp?id=123 </ link>



   



 <description> <! [CDATA [Brief Description ...

 



 ]]></ Description>



   



 <author> MioSito.ext </ author>



   



 <pubDate> Tues, 01 Apr 2008 GMT </ pubDate>



   



 <category domain="http://www.miosito.ext/categoria.asp?id=5"> Name Category </ category>



   



 <GUID isPermaLink="true"> http://www.miosito.ext/notizia.asp?id=123 </ guid>



  



 </ Item>



 



 </ Channel>







 </ Rss>



The basic structure

It is a basic form of RSS 2.0 but tags are available to many more, so we start looking at used ones, starting from the basic structure.

The basic structure used primarily sees the xml header, then the rss tag that contains attributes that specifies the URL of his official namespaces, and then the channel tag that will contain data files of all the RSS feeds.

The channel consists of three parts:

  • header of the site that releases the feed;
  • management of the site's logo that releases the feed;
  • all items in the feed, representing the individual reports.
In the following paragraphs we will examine all elements dividing schematically in compulsory and optional subjects.

The channel element: elements required

By virtue of what is listed in the previous paragraph, we see that the element channel sees in all the RSS feeds, so it might sound silly to talk about thinking as an element in its own right.

In order dui discuss all the elements that go directly specified in the channel, referring to after the compulsory and optional elements and image items.

The following is a detailed list of required tags of the channel element.

  • title - specifies the title of the news;
  • link - Specifies the complete URL of the news;
  • description - Specifies the first N characters of descriptive information.
Using CDATA in title and description

There is no doubt that the XML file must be drawn respecting the semantic rules of XML itself, or handle special characters and other potentially annoying and hazardous aspects in relation to the integrity of the XML file in question.

However, especially in the field of news, it can happen often be faced with difficult to manage exceptions that would send the XML file in error and consequently the script that remotely read it to display the feed.

The problem is simply controlled through the CDATA command, once the XML file is the best managed, manages exceptions unmanageable in terms of character and potential small but crucial errors.

The code example shown above explains, at a practical level, how to integrate it within the XML tags:

 



 <title> <b> <! [CDATA [</ b> Title of the news <b> ]]></ b> </ title>

 
I have highlighted in bold code to make it more distinguishable CDATA when reading and learning of the concept in question in this section.

In the same category ...
E-Learning
CSS (Course) CSS (Course)
Web Design and Accessibility according to W3C CSS and XHTML. Starting from 29 €.
XML (Course) XML (Course)
Creation of XML structures, XSL and other languages ​​extensible. Starting from 29 €.
Sponsored Links