on Thu Aug 28 11:23:49 GMT 2008 in XML and viewed 5573 times
An introduction to the trend sweeping the web, RSS Feeds, or Really Simple Syndication (or Rich Site Summary).
RSS Feeds are something I’ve been talking about for a while. But how do you use them? Well, this tutorial will teach the very simple ins and outs of RSS. Later another tutorial will be written showing the more advanced elements in RSS.
For this tutorial, I’ll be writing an RSS 2.0 Feed. There are other versions including RSS 0.9 and 1.0.
RSS is basically an XML file. XML stands for eXtensible Markup Language, and RSS stands for either Rich Site Summary, or Really Simple Syndication.
The first thing you start off with in RSS is a declaration of the document type definition, or DTD. RSS is as follows:
<?xml version="1.0"?>
<rss version="2.0">
This first defines it as an XML file and the second, an RSS file. The next thing you need to do is open a channel. What the channel does is it opens the basic info about your site. For this example we’ll use my site, http://www.shadow-fox.net
<channel>
<title>The Shadow Fox Network News Feed</title>
<link>http://www.shadow-fox.net/</link>
<description>All news concerning new releases of tutorials will be told here.
This can include new articles on php, html, css, rss, xml, javascript, and more.
</description>
<author>webmaster@shadow-fox.net</author>
<language>en-us</language>
<channel> is the starting element for the actual channel in the RSS file. Most of the elements are pretty self explanatory, but I’ll explain away anyways. <Title> is the title of the feed, not the actual site title. <Link> is a link to your website, not the feed. <Description> talks about the feed, not your site. <Author> should be reserved for your email, and <language> is the language.
Now the next thing you need is the feed items. Basically those are the content in the feed. So if you have a feed about your first 5 news articles, there’ll be 5 items. These are defined very easily like this:
<item>
<title>Title of the item</title>
<link>http://www.shadow-fox.net/link/to/item</link>
<description>The content in the item.</description>
</item>
The elements again are pretty self explanatory, but they’ll be explained again anyways. <Title> is the title of the feed item, so if you have a news article, it’ll be your article title. <Link> is the link to the article on your website. And <description> is the content inside the item.
And finally there’s the closing elements which are very simple. You have to close the channel and the title.
</channel>
</rss>
All XML tags should be closed except for the beginning XML declaration.
So there you go. Save your feed as nameoffeed.xml and link it on your site and submit it to feed directories.
thanks for ur tutorial, i thought it wud be complicated, but u made it v simple. The best RSS feed tutorial for Beginers.
by gs