June 10, 2004

Creating the RSS Feed

Now that I am sold on RSS how do I create the RSS feed?

There are several options for creating an RSS feed to syndicate your content. The simplest way might be to check the application that you are using for content management. It may already have the capability built-in. If you are using "blogging" software chances are that the RSS feed is already created for you.

If you are not using either a CMS or blogging software you might consider installing it and trying it out. Blog software such as Moveable Type and WordPress create the RSS feeds automatically. Just write your article, submit, and you are done.

Another way that you might be able to create an RSS feed, especially if you are using blogging software that does not create the feed (example Blogger), is to go to a site such as Feedster.com or Blogstreet.com. These sites will allow you to register your web content site and build the RSS files for you. The method they use is sometimes called "scraping." Some of these scraping tools work by looking for special HTML tags within the web page (usually <span> and <div> tags), then building the RSS file with the content contained within these tags.

If none of the above methods work you can always fill out a form from WebDevTips (http://www.webdevtips.com/webdevtips/codegen/rss.shtml). Enter the information you want in your feed into a web form and press submit. It is not automated, but it is easy, and one nice feature is it will preload the form with existing data from a current feed. This means you only have to make changes, not enter everything again.

OK, so you don't use blogging software, forms are a hassle, but you have content that would lend itself to being syndicated. Now what? If your site is generated with a scripting language like PHP or Perl, then there are software libraries you can use to write your own. It is doable!

Many of the languages already have built in functions to assist you and example code. The following is a list of various libraries and information to help you write RSS files ordered by software language.

-----------------------------------------------------------------------------------

PHP
Tutorial: http://www.computerworld.com/developmenttopics/development/story/0,10801,86464p2,00.html
http://richardathome.no-ip.com/index.php?article_id=20
WROX publication: Professional PHP4 XML


Python
Library RSS.py and tutorial: http://www.opensourcetutorials.com/tutorials/Server-Side-Coding/Python/rss-for-poython
via scraping http://www.mnot.net/xpath2rss/
with Zope: http://www.zopelabs.com/cookbook/1071864400

Perl
Module: XML::RSS
Tutorial: http://www.perl.com/pub/a/2001/11/15/creatingrss.html

ColdFusion MX
Tutorial http://www.webpronews.com/webdevelopment/webapplications/wpn-27-20040405CreatingYourVeryOwnRSSXMLFeedswithColdFusionMX.html


ASP
Tutorial: http://www.softtool.info/RSSMaster/


-----------------------------------------------------------------------------------


Now that you have your feed created you will want to make sure the feed is valid. The main site for performing feed verification is Feed Validator. They consistently are updating their site to meet the changing versions of RSS, RDF, and Atom. Bonus: their code is open source, so you can get a copy and set up your own verification site if you wish.

Verifying the feed:
http://feedvalidator.org
http://feeds.archive.org/validator/ (Mirror site)

Of course the RSS feed can be displayed with feed readers, but one other thing you might want to do with an RSS feed is to display its content on a web page. Of course, there are many ways of doing this and the best way will most likely depend on what you currently use to display dynamic content within your web site. Here is a list of some software libraries and tutorials that will enable you to parse a RSS feed and turn the contents into web content.


-----------------------------------------------------------------------------------

PHP
MagpieRSS - magpierss.sourceforge.net - parses .9x, 1, 2, Atom
Zend.com example http://www.zend.com/zend/spotlight/code-gallery-wade6.php
Caching parser http://www.geckotribe.com/rss/carp

Python
RSS.py and RSSparser.py - see the following url for details:

Perl
Requires Perl modules XML::Parser and XML::RSS
Tutorial at http://www.webreference.com/perl/tutorial/8/

ColdFusion MX
contains XML functions to parse RSS
tutorial: http://www.fusetalk.com/files/cfdj_Aug2003.pdf

Java/JSP
Using RSS in JSP pages
http://today.java.net/pub/a/today/2003/08/08/rss.html

ASP
http://www.freevbcode.com/ShowCode.Asp?ID=5665
.NET version
http://www.freevbcode.com/ShowCode.Asp?ID=5670

-----------------------------------------------------------------------------------

Posted by ray_kimsey at June 10, 2004 12:18 PM
Comments