O'Reilly logo

Content Syndication with RSS by Ben Hammersley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating RSS 1.0 Feeds

Despite the additional complexity of the RDF attributes, the methods for creating RSS 1.0 feeds are similar to those used to create RSS 0.9x feeds (discussed in Chapter 4).

Creating RSS 1.0 with Perl

The XML::RSS module we used in Chapter 4 also works for RSS 1.0, with a few changes to the scripts. Example 6-4 shows a sample script to produce the feed shown in Example 6-5.

Example 6-4. Creating RSS 1.0 with Perl

#!/usr/local/bin/perl -w use XML::RSS; my $rss = new XML::RSS (version => '1.0'); $rss->channel(title => "The Title of the Feed", link => "http://www.oreilly.com/example/", description => "The description of the Feed", dc => { date => "2000-08-23T07:00+00:00", subject => "Linux Software", creator => "scoop@freshmeat.net", publisher => "scoop@freshmeat.net", rights => "Copyright 1999, Freshmeat.net", language => "en-us", }, ); $rss->image(title => "Oreilly", url => "http://meerkat.oreillynet.com/icons/meerkat-powered.jpg", link => "http://www.oreilly.com/example/", dc => { creator => "G. Raphics (graphics at freshmeat.net)", }, ); $rss->textinput(title => "Search", description => "Search the site", name => "query", link => "http://www.oreilly.com/example/search.cgi" ); $rss->add_item( title => "Example Entry 1", link => "http://www.oreilly.com/example/entry1", description => 'blah blah', dc => { subject => "Software", }, ); $rss->add_item( title => "Example Entry 2", link => "http://www.oreilly.com/example/entry2", description => 'blah blah' ); $rss->add_item( ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required