Home arrow XML arrow Page 3 - Simple Web Syndication with RSS 2.0
XML

Simple Web Syndication with RSS 2.0


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.

Author Info:
By: Nilpo/Developer Shed Staff Writer
Rating: 5 stars5 stars5 stars5 stars5 stars / 20
January 24, 2007
TABLE OF CONTENTS:
  1. · Simple Web Syndication with RSS 2.0
  2. · Sharing your content
  3. · The XML:RSS 2.0 namespace
  4. · Expanding the channel
  5. · Expanding your content listing
  6. · Making your feed available

print this article
SEARCH DEVARTICLES

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" ?>

<rss version="2.0">

 

<channel>

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>

<link>http://www.nilpo.com</link>

<language>en-us</language>

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.

<item>

   <title>A New Toolbar Can Boost Your Web Site Traffic
Dramatically</title>

   <description>Dev Articles - Embedded Tools - 1/10/07</description>

   <link>http://www.devarticles.com/c/a/Embedded-Tools/A-New-Toolbar-Can-
Boost-Your-Web-Site-Traffic-Dramatically</link>

</item>

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.

</channel>

</rss>

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.


blog comments powered by Disqus
XML ARTICLES

- Open XML Finally Supported by MS Office
- XML Features Added to Two Systems
- Using Regions with XSL Formatting Objects
- Using XSL Formatting Objects
- More Schematron Features
- Schematron Patterns and Validation
- Using Schematron
- Datatypes and More in RELAX NG
- Providing Options in RELAX NG
- An Introduction to RELAX NG
- Path, Predicates, and XQuery
- Using Predicates with XQuery
- Navigating Input Documents Using Paths
- XML Basics
- Introduction to XPath

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials