Cover | Table of Contents | Colophon
XLST transformation
XHTML document
HTML
document
HTML document
NotePad
HTML document
HTML document
XLST transformation
XHTML document
HTML
document
HTML document
NotePad
HTML document
HTML document
<?xml version="1.0"?> <rss version="0.91"> <channel> <title>Meerkat: An Open Wire Service</title> <link>http://meerkat.oreillynet.com/</link> <description>Meerkat is a Web-based syndicated content reader </description> <language>en-us</language> <image> <title>Meerkat Powered!</title> <url>http://meerkat.oreillynet.com/icons/meerkat-powered.jpg</url> <link>http://meerkat.oreillynet.com/</link> </image> <item> <title>The First Item</title> <link>http://www.oreilly.com/example/001.html</link> <description>This is the first item.</description> </item> <item> <title>The Second Item</title> <link>http://www.oreilly.com/example/002.html</link> <description>This is the second item.</description> </item> <item> <title>The Third Item</title> <link>http://www.oreilly.com/example/003.html</link> <description>This is the third item.</description> </item> </channel> </rss>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="0.91">
<channel>
<title>RSS0.91 Example</title>
<link>http://www.exampleurl.com/example/index.html</link>
<description>This is an example RSS0.91 feed</description>
<language>en-gb</language>
<copyright>Copyright 2002, Oreilly and Associates.</copyright>
<managingEditor>editor@exampleurl.com</managingEditor>
<webMaster>webmaster@exampleurl.com</webMaster>
<rating></rating>
<pubDate>03 Apr 02 1500 GMT</pubDate>
<lastBuildDate>03 Apr 02 1500 GMT</lastBuildDate>
<docs>http://backend.userland.com/rss091</docs>
<skipDays>
<day>Monday</day>
</skipDays>
<skipHours>
<hour>20</hour>
</skipHours>
<image>
<title>RSS0.91 Example</title>
<url>http://www.exampleurl.com/example/images/logo.gif</url>
<link>http://www.exampleurl.com/example/index.html</link>
<width>88</width>
<height>31</height>
<description>Computer Books, Conferences, Online Publishing</description>
</image>
<textInput>
<title>
<description>
<name>
<link>
</textInput>
<item>
<title>The First Item</title>
<link>http://www.exampleurl.com/example/001.html</link>
<description>This is the first item.</description>
</item>
<item>
<title>The Second Item</title>
<link>http://www.exampleurl.com/example/002.html</link>
<description>This is the second item.</description>
</item>
<item>
<title>The Third Item</title>
<link>http://www.exampleurl.com/example/003.html</link>
<description>This is the third item.</description>
</item>
</channel>
</rss>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="0.91">
<channel>
<title>RSS0.91 Example</title>
<link>http://www.exampleurl.com/example/index.html</link>
<description>This is an example RSS0.91 feed</description>
<language>en-gb</language>
<copyright>Copyright 2002, Oreilly and Associates.</copyright>
<managingEditor>editor@exampleurl.com</managingEditor>
<webMaster>webmaster@exampleurl.com</webMaster>
<rating></rating>
<pubDate>03 Apr 02 1500 GMT</pubDate>
<lastBuildDate>03 Apr 02 1500 GMT</lastBuildDate>
<docs>http://backend.userland.com/rss091</docs>
<skipDays>
<day>Monday</day>
</skipDays>
<skipHours>
<hour>20</hour>
</skipHours>
<image>
<title>RSS0.91 Example</title>
<url>http://www.exampleurl.com/example/images/logo.gif</url>
<link>http://www.exampleurl.com/example/index.html</link>
<width>88</width>
<height>31</height>
<description>Computer Books, Conferences, Online Publishing</description>
</image>
<textInput>
<title>
<description>
<name>
<link>
</textInput>
<item>
<title>The First Item</title>
<link>http://www.exampleurl.com/example/001.html</link>
<description>This is the first item.</description>
</item>
<item>
<title>The Second Item</title>
<link>http://www.exampleurl.com/example/002.html</link>
<description>This is the second item.</description>
</item>
<item>
<title>The Third Item</title>
<link>http://www.exampleurl.com/example/003.html</link>
<description>This is the third item.</description>
</item>
</channel>
</rss>
<?xml version="1.0"?>
<rss version="0.92">
<channel>
<title>RSS0.92 Example</title>
<link>http://www.exampleurl.com/example/index.html</link>
<description>This is an example RSS0.91 feed</description>
<language>en-gb</language>
<copyright>Copyright 2002, Oreilly and Associates.</copyright>
<managingEditor>editor@exampleurl.com</managingEditor>
<webMaster>webmaster@exampleurl.com</webMaster>
<rating> </rating>
<pubDate>03 Apr 02 1500 GMT</pubDate>
<lastBuildDate>03 Apr 02 1500 GMT</lastBuildDate>
<docs>http://backend.userland.com/rss091</docs>
<skipDays><day>Monday</day></skipDays>
<skipHours><hour>20</hour></skipHours>
<cloud domain="http://www.exampleurl.com" port="80" path="/RPC2"
registerProcedure="pleaseNotify" protocol="XML-RPC" />
<image>
<title>RSS0.91 Example</title>
<url>http://www.exampleurl.com/example/images/logo.gif</url>
<link>http://www.exampleurl.com/example/index.html</link>
<width>88</width>
<height>31</height>
<description>The World's Leading Technical Publisher</description>
</image>
<textInput>
<title>Search</title>
<description>Search the Archives</description>
<name>query</name>
<link>http://www.exampleurl.com/example/search.cgi</link>
</textInput>
<item>
<title>The First Item</title>
<link>http://www.exampleurl.com/example/001.html</link>
<description>This is the first item.</description>
<source url="http://www.anothersite.com/index.xml">Another Site</source>
<enclosure url="http://www.exampleurl.com/example/001.mp3" length="543210" type"audio
/mpeg"/>
<category domain="http://www.dmoz.org">Business/Industries/Publishing/Publishers/
Nonfiction/Business/O'Reilly_and_Associates/</category>
</item>
<item>
<title>The Second Item</title>
<link>http://www.exampleurl.com/example/002.html</link>
<description>This is the second item.</description>
<source url="http://www.anothersite.com/index.xml">Another Site</source>
<enclosure url="http://www.exampleurl.com/example/002.mp3" length="543210" type"audio/
mpeg"/>
<category domain="http://www.dmoz.org">Business/Industries/Publishing/Publishers/
Nonfiction/Business/O'Reilly_and_Associates/</category>
</item>
<item>
<title>The Third Item</title>
<link>http://www.exampleurl.com/example/003.html</link>
<description>This is the third item.</description>
<source url="http://www.anothersite.com/index.xml">Another Site</source>
<enclosure url="http://www.exampleurl.com/example/003.mp3" length="543210" type"audio/
mpeg"/>
<category domain="http://www.dmoz.org">Business/Industries/Publishing/Publishers/
Nonfiction/Business/O'Reilly_and_Associates/</category>
</item>
</channel>
</rss>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>RSS2.0Example</title>
<link>http://www.exampleurl.com/example/index.html</link>
<description>This is an example RSS 2.0 feed</description>
<language>en-gb</language>
<copyright>Copyright 2002, Oreilly and Associates.</copyright>
<managingEditor>example@exampleurl.com</managingEditor>
<webMaster>webmaster@exampleurl.com</webMaster>
<rating> </rating>
<pubDate>03 Apr 02 1500 GMT</pubDate>
<lastBuildDate>03 Apr 02 1500 GMT</lastBuildDate>
<docs>http://backend.userland.com/rss</docs>
<skipDays><day>Monday</day></skipDays>
<skipHours><hour>20</hour></skipHours>
<category domain="http://www.dmoz.org">Business/Industries/Publishing/Publishers/
Nonfiction/Business/O'Reilly_and_Associates/</category>
<generator>NewsAggregator'o'Matic</generator>
<ttl>30</ttl>
<cloud domain="http://www.exampleurl.com" port="80" path="/RPC2" registerProcedure=
"pleaseNotify" protocol="XML-RPC" />
<image>
<title>RSS2.0 Example</title>
<url>http://www.exampleurl.com/example/images/logo.gif</url>
<link>http://www.exampleurl.com/example/index.html</link>
<width>88</width>
<height>31</height>
<description>The World's Leading Technical Publisher</description>
</image>
<textInput>
<title>Search</title>
<description>Search the Archives</description>
<name>query</name>
<link>http://www.exampleurl.com/example/search.cgi</link>
</textInput>
<item>
<title>The First Item</title>
<link>http://www.exampleurl.com/example/001.html</link>
<description>This is the first item.</description>
<dc:creator>A.N. Author</dc:creator>
<source url="http://www.anothersite.com/index.xml">Another Site</source>
<enclosure url="http://www.exampleurl.com/example/001.mp3" length="543210" type"
audio/mpeg"/>
<category domain="http://www.dmoz.org">Business/Industries/Publishing/Publishers/
Nonfiction/Business/O'Reilly_and_Associates/</category>
<comments>http://www.exampleurl.com/comments/001.html</comments>
<author>Ben Hammersley</author>
<pubDate>Sat, 01 Jan 2002 0:00:01 GMT</pubDate>
<guid isPermaLink="true">http://www.exampleurl.com/example/001.html</guid>
</item>
<item>
<title>The Second Item</title>
<link>http://www.exampleurl.com/example/002.html</link>
<description>This is the second item.</description>
<dc:creator>A.N. Author</dc:creator>
<source url="http://www.anothersite.com/index.xml">Another Site</source>
<enclosure url="http://www.exampleurl.com/example/002.mp3" length="543210"
type"audio/mpeg"/>
<category domain="http://www.dmoz.org">Business/Industries/Publishing/Publishers/
Nonfiction/Business/O'Reilly_and_Associates/</category>
<comments>http://www.exampleurl.com/comments/002.html</comments>
<author>Ben Hammersley</author>
<pubDate>Sun, 02 Jan 2002 0:00:01 GMT</pubDate>
<guid isPermaLink="true">http://www.exampleurl.com/example/002.html</guid>
</item>
<item>
<title>The Third Item</title>
<link>http://www.exampleurl.com/example/003.html</link>
<description>This is the third item.</description>
<dc:creator>A.N. Author</dc:creator>
<source url="http://www.anothersite.com/index.xml">Another Site</source>
<enclosure url="http://www.exampleurl.com/example/003.mp3" length="543210" type"
audio/mpeg"/>
<category domain="http://www.dmoz.org">Business/Industries/Publishing/Publishers/
Nonfiction/Business/O'Reilly_and_Associates/</category>
<comments>http://www.exampleurl.com/comments/003.html</comments>
<author>Ben Hammersley</author>
<pubDate>Mon, 03 Jan 2002 0:00:01 GMT</pubDate>
<guid isPermaLink="true">http://www.exampleurl.com/example/003.html</guid>
</item>
</channel>
</rss>
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:co="http://purl.org/rss/1.0/modules/company/"
xmlns:ti="http://purl.org/rss/1.0/modules/textinput/"
xmlns="http://purl.org/rss/1.0/"
>
<channel rdf:about="http://meerkat.oreillynet.com/?_fl=rss1.0">
<title>Meerkat</title>
<link>http://meerkat.oreillynet.com</link>
<description>Meerkat: An Open Wire Service</description>
<dc:publisher>The O'Reilly Network</dc:publisher>
<dc:creator>Rael Dornfest (mailto:rael@exampleurl.com)</dc:creator>
<dc:rights>Copyright © 2000 O'Reilly & Associates, Inc.</dc:rights>
<dc:date>2000-01-01T12:00+00:00</dc:date>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>2</sy:updateFrequency>
<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
<image rdf:resource="http://meerkat.oreillynet.com/icons/meerkat-powered.jpg" />
<textinput rdf:resource="http://meerkat.oreillynet.com" />
<items>
<rdf:Seq>
<rdf:li resource="http://c.moreover.com/click/here.pl?r123" />
</rdf:Seq>
</items>
</channel>
<image rdf:about="http://meerkat.oreillynet.com/icons/meerkat-powered.jpg">
<title>Meerkat Powered!</title>
<url>http://meerkat.oreillynet.com/icons/meerkat-powered.jpg</url>
<link>http://meerkat.oreillynet.com</link>
</image>
<textinput rdf:about="http://meerkat.oreillynet.com">
<title>Search Meerkat</title>
<description>Search Meerkat's RSS Database...</description>
<name>s</name>
<link>http://meerkat.oreillynet.com/</link>
<ti:function>search</ti:function>
<ti:inputType>regex</ti:inputType>
</textinput>
<item rdf:about="http://c.moreover.com/click/here.pl?r123">
<title>XML: A Disruptive Technology</title>
<link>http://c.moreover.com/click/here.pl?r123</link>
<dc:description>This the description of the article</dc:description>
<dc:publisher>The O'Reilly Network</dc:publisher>
<dc:creator>Simon St.Laurent (mailto:simonstl@simonstl.com)</dc:creator>
<dc:rights>Copyright © 2000 O'Reilly & Associates, Inc.</dc:rights>
<dc:subject>XML</dc:subject>
<co:name>XML.com</co:name>
<co:market>NASDAQ</co:market>
<co:symbol>XML</co:symbol>
</item>
</rdf:RDF>http://backend.userland.com/rss091). Its
author, Dave
Winer,
did not invent any new practices with this specification, but he did
codify RSS in a far more precise way than the Netscape original (at
http://my.netscape.
com/publish/formats/rss-spec-0.91.html),
based on common practice at the time. Primarily, the new codification
imposed limits on the number of characters allowed within each
element.™ cannot be used
without it). Example 4-1 provides a DTD declaration
for those who wish to use one.<?xml version="1.0"?> <!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd"> <rss version="0.91">
<rss
version="0.91">
element. This is followed by a single channel
element. The channel element contains the entire
feed contents and all associated metadata.channel within RSS 0.91:title
http://backend.userland.com/rss091). Its
author, Dave
Winer,
did not invent any new practices with this specification, but he did
codify RSS in a far more precise way than the Netscape original (at
http://my.netscape.
com/publish/formats/rss-spec-0.91.html),
based on common practice at the time. Primarily, the new codification
imposed limits on the number of characters allowed within each
element.™ cannot be used
without it). Example 4-1 provides a DTD declaration
for those who wish to use one.<?xml version="1.0"?> <!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd"> <rss version="0.91">
<rss
version="0.91">
element. This is followed by a single channel
element. The channel element contains the entire
feed contents and all associated metadata.channel within RSS 0.91:title
link
description
<rss
version="0.91"> becomes <rss
version="0.92">.item
elements as you like.item are optional.language
is now
optional.<source url="">
item. It should contain
the name of the RSS feed of the site from which the
item is derived, and the attribute
url should be the URL of the other
site's RSS feed.<enclosure url="" length="" type=""/>
item used to describe a
file associated with an item. It has no content,
but it takes three attributes: url is the URL of
the enclosure, length is its size in bytes, and
type is the standard
MIME type for the enclosure.<category domain="">
item that takes one
attribute, domain. The value of
category should be a forward slash-separated
string that identifies a hierarchical location in a taxonomy
represented by the domain attribute. See Example 4-3 for an example.<cloud domain="" port="" path="" registerProcedure="" protocol="" />XML::RSS.XML::RSS
module for
Perl is one of the key tools in the Perl
RSS world. It is built on top of XML::Parser
— the basis for many Perl XML modules — and it is
object-oriented. Actually, XML::RSS also supports
both creating RSS 1.0 and parsing existing feeds, but in this section
we will deal only with its 0.91 creation capabilities. Currently, it
does not support the additional elements within RSS 0.92.#!/usr/local/bin/perl -w
## Chapter 4, Example 1.
## Create an example RSS 0.91 feed
use XML::RSS;
my $rss = new XML::RSS (version => '0.91');
$rss->channel(title => 'The Title of the Feed',
link => 'http://www.oreilly.com/example/',
language => 'en',
description => 'An example feed created by XML::RSS',
lastBuildDate => 'Tue, 04 Jun 2002 16:20:26 GMT',
docs => 'http://backend.userland.com/rss092',
);
$rss->image(title => 'Oreilly',
url => 'http://meerkat.oreillynet.com/icons/meerkat-powered.jpg',
link => 'http://www.oreilly.com/example/',
width => 88,
height => 31,
description => 'A nice logo for the feed'
);
$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',
);
$rss->add_item( title => "Example Entry 2",
link => "http://www.oreilly.com/example/entry2",
description => 'blah blah'
);
$rss->add_item( title => "Example Entry 3",
link => "http://www.oreilly.com/example/entry3",
description => 'blah blah'
);
$rss->save("example.rss");http://www.syndic8.com/suggest_start.php
http://www.newsisfree.com/contact.php
http://aggregator.userland.com/register
link element).head
elements within your page:<link rel="alternate" type="application/rss+xml" title="RSS" href="url/to/rss/file">
channel was last updated, and so on. In Example 5-1, the bold code is the metadata. You could
remove this data, and the feed itself would still both parse and be
useful to the reader when displayed as HTML. The metadata is in the
background, silent, but meaningful to those who can see it.<rss version="0.92"> <channel> <title>RSS0.92 Example</title> <link>http://www.oreilly.com/example/index.html</link> <description>This is an example RSS0.91 feed</description> <language>en-gb</language> <copyright>Copyright 2002, Oreilly and Associates.</copyright> <managingEditor>editor@oreilly.com</managingEditor> <webMaster>webmaster@oreilly.com</webMaster> <pubDate>03 Apr 02 1500 GMT</pubDate> <lastBuildDate>03 Apr 02 1500 GMT</lastBuildDate> <docs>http://backend.userland.com/rss091</docs> <skipDays> <day>Monday</day> </skipDays> <skipHours> <hour>20</hour>
channel was last updated, and so on. In Example 5-1, the bold code is the metadata. You could
remove this data, and the feed itself would still both parse and be
useful to the reader when displayed as HTML. The metadata is in the
background, silent, but meaningful to those who can see it.<rss version="0.92"> <channel> <title>RSS0.92 Example</title> <link>http://www.oreilly.com/example/index.html</link> <description>This is an example RSS0.91 feed</description> <language>en-gb</language> <copyright>Copyright 2002, Oreilly and Associates.</copyright> <managingEditor>editor@oreilly.com</managingEditor> <webMaster>webmaster@oreilly.com</webMaster> <pubDate>03 Apr 02 1500 GMT</pubDate> <lastBuildDate>03 Apr 02 1500 GMT</lastBuildDate> <docs>http://backend.userland.com/rss091</docs> <skipDays> <day>Monday</day> </skipDays> <skipHours> <hour>20</hour> </skipHours> <cloud domain="http://www.oreilly.com" port="80" path="/RPC2" registerProcedure="pleaseNotify" protocol="XML-RPC" /> <image> <title>RSS0.91 Example</title> <url>http://www.oreilly.com/example/images/logo.gif</url> <link>http://www.oreilly.com/example/index.html</link> <width>88</width> <height>31</height> <description>The World's Leading Technical Publisher</description> </image> <textInput> <title>Search</title> <description>Search the Archives</description> <name>query</name> <link>http://www.oreilly.com/example/search.cgi</link> </textInput> <item> <title>The First Item</title> <link>http://www.oreilly.com/example/001.html</link> <description>This is the first item.</description> <source url="http://www.anothersite.com/index.xml">Another Site</source>
http://www.benhammersley.com
(resource)."managingEditor example as three nodes, connected
by two arcs — two separate RDF triples. By convention, the
subject is at the blunt end of the
arrow, the property (or predicate) is the arrow itself, and the
object is at the pointy end of the arrow.