RSS was originally created in 1999 by Netscape as a channel description framework for their My Netscape Network. MNN was a portal system that allowed end users to selectively view new content from their choice of content providers. RSS was created as a means of gathering that content. Since its creation, RSS has been updated and expanded to handle a much wider range of content with a far broader range of uses.
Simple Web Syndication with RSS 2.0 - The XML:RSS 2.0 namespace (Page 3 of 6 )
Letís begin with the basics. Youíll start your RSS feed by setting up an XML document.
<?xml version="1.0" ?>
The opening tag establishes our file as an XML document. The next tag tells the XML parser that we are using the RSS 2.0 namespace. This allows us to use ďshortĒ tag names to reference our elements. Finally, we use the channel element to indicate the start of our RSS channel feed.
Next we want to identify what our channel will hold. In this example, Iím going to build an RSS feed for all of my articles published on the Developer Shed network of sites. So Iíll add this next piece of code.
<title>Popular Articles by Nilpo</title>
<description>Popular articles by Nilpo published by Developer Shed.</description>
The first three elements are required. The title element defines the name of your channel. In most cases this is just the name of your web site. The description provides a brief overview of the channels contents. The link element is used to provide a valid URI to the html website that the channel corresponds to. Iíve also included the language element. This element optionally defines the language that the channel is written in. Valid values for this element must be RFC 1766 compliant.
Now that weíve established a channel, we can begin adding content. The RSS 2.0 namespace provides the item element for this. Take a look at the following code segment.
<title>A New Toolbar Can Boost Your Web Site Traffic Dramatically</title>
Here weíve defined at item for our channel. Three basic elements are required: title, description, and link. Title defines the title for our item. This should be a descriptive name for the content that it holds. In my case, the name of the article is appropriate. The description should describe the content. I could have given and overview or an introduction to the articles, but instead I chose to add the site information and publication date. Finally, the link element should provide the URL to the content itself.
You would add subsequent items in the same way. Each item should be enclosed it its own item element.
We end our RSS channel by closing the channel and rss tags. This is a basic RSS feed although at this point itís still formed pretty poorly. Many news readers would have a hard time updating this feed properly because we havenít provided any information to differentiate between existing items and newly added ones.