XML
  Home arrow XML arrow Page 3 - Simple Web Syndication with RSS 2.0
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
XML

Simple Web Syndication with RSS 2.0
By: Nilpo/Developer Shed Staff Writer
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 12
    2007-01-24

    Table of Contents:
  • Simple Web Syndication with RSS 2.0
  • Sharing your content
  • The XML:RSS 2.0 namespace
  • Expanding the channel
  • Expanding your content listing
  • Making your feed available

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    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.

    More XML Articles
    More By Nilpo/Developer Shed Staff Writer


       · This is the first of a 3 part series that deals with Web Syndication. We start off...
       · Awesome article! I've followed the instructions and have successfully set up a RSS...
       · Thanks for the comments. I'm glad that you found this article helpful. :)
     

    XML ARTICLES

    - 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
    - Simple Web Syndication with RSS 2.0
    - Java UI Design with an IDE







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    Stay green...Green IT