RSS – Inside (Part 2)

Tuesday, March 27th, 2007

In the previous article I demonstrated a practical application of RSS with Google Reader.

Now that we have a working example of RSS in action, let’s dig a bit deeper and see what’s inside an RSS feed. For this article, we’re going to use RSS 2.0 as our primary example.

An RSS feed is made up of two main parts: information about our feed and the items in our feed.

Information about our feed describe what the feed is all about.  It includes elements such as the blog title, link to our blog and description of our blog. All of this information is mandatory.

The other part (items) can be thought of as each individual blog post. Each item has elements that describe the post. These elements include the title of the post, the link to the full post, the full content or snippet of the post, the author, and date published. All of these elements except the author and publication date is mandatory.

Let’s take a look at a sample RSS file

<?xml version="1.0"?>
<rss version="2.0">
        <channel>
        <title>nickpeters.net</title>
        <link>http://www.nickpeters.net</link>
        <description>Blog of Nick Peters</description>
        <item>
                <title>Blog Post 1</title>
                <link>http://www.nickpeters.net/blog-post-1</link>
                <author>Nick Peters</author>
                <description>This is a Blog Post!</description>
		<pubDate>Mon, 26 Mar 2007 09:39:21 GMT</pubDate>

        </item>
	<item>
                <title>Blog Post 2</title>
                <link>http://www.nickpeters.net/blog-post-2</link>
                <author>Nick Peters</author>
                <description>This is a another Blog Post!</description>
		<pubDate>Tue, 27 Mar 2007 011:52:38 GMT</pubDate>

        </item>
        </channel>
</rss>

Let’s first take note that this information is very minimal, but it should be enough to get key ideas across. A full list of elements can be found here.

From looking at the information above we can see that the name our blog is “nickpeters.net,” the URL of the blog is http://www.nickpeters.net and the description is “Blog of Nick Peters.”

This blog has two posts: “Blog Post 1” and “Blog Post 2.” Each post has a link, author, description and publication date.

RSS feeds are pretty self explanatory; it’s an XML file that describes the contents of a blog for easy manipulation in clients such as RSS readers.

Next we will see how easy it is to create an RSS feed using PHP and MySQL.

Leave a Reply