The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
[%#
  # IMPORTANT NOTE
  #   This documentation is generated automatically from source
  #   templates.  Any changes you make here may be lost.
  # 
  #   The 'docsrc' documentation source bundle is available for download
  #   from http://www.template-toolkit.org/docs.html and contains all
  #   the source templates, XML files, scripts, etc., from which the
  #   documentation for the Template Toolkit is built.
-%]
[% META book = 'Modules'
        page = 'Plugin_XML_RSS'
%]
[%  WRAPPER toc;
	PROCESS tocitem 
	        title ="SYNOPSIS"
                subs  = [];
	PROCESS tocitem 
	        title ="PRE-REQUISITES"
                subs  = [];
	PROCESS tocitem 
	        title ="DESCRIPTION"
                subs  = [];
	PROCESS tocitem 
	        title ="AUTHORS"
                subs  = [];
	PROCESS tocitem 
	        title ="VERSION"
                subs  = [];
	PROCESS tocitem 
	        title ="COPYRIGHT"
                subs  = [];
	PROCESS tocitem 
	        title ="SEE ALSO"
                subs  = [];
    END
%]
<!-- Pod to HTML conversion by the Template Toolkit version 2 -->
[% WRAPPER section
    title="SYNOPSIS"
-%]<pre>    [% tt_start_tag %] USE news = XML.RSS($filename) [% tt_end_tag %]
   
    [% tt_start_tag %] FOREACH item = news.items [% tt_end_tag %]
       [% tt_start_tag %] item.title [% tt_end_tag %]
       [% tt_start_tag %] item.link  [% tt_end_tag %]
    [% tt_start_tag %] END [% tt_end_tag %]</pre>
[%- END %]
[% WRAPPER section
    title="PRE-REQUISITES"
-%]<p>
This plugin requires that the XML::Parser and XML::RSS modules be 
installed.  These are available from CPAN:
</p>
<pre>    http://www.cpan.org/modules/by-module/XML</pre>
[%- END %]
[% WRAPPER section
    title="DESCRIPTION"
-%]<p>
This Template Toolkit plugin provides a simple interface to the
XML::RSS module.
</p>
<pre>    [% tt_start_tag %] USE news = XML.RSS('mysite.rdf') [% tt_end_tag %]</pre>
<p>
It creates an XML::RSS object, which is then used to parse the RSS
file specified as a parameter in the USE directive.  A reference to
the XML::RSS object is then returned.
</p>
<p>
An RSS (Rich Site Summary) file is typically used to store short news
'headlines' describing different links within a site.  This example is
extracted from http://slashdot.org/slashdot.rdf.
</p>
<pre>    &lt;?xml version=&quot;1.0&quot;?&gt;&lt;rdf:RDF
    xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;
    xmlns=&quot;http://my.netscape.com/rdf/simple/0.9/&quot;&gt;
    
      &lt;channel&gt;
    	&lt;title&gt;Slashdot:News for Nerds. Stuff that Matters.&lt;/title&gt;
    	&lt;link&gt;http://slashdot.org&lt;/link&gt;
    	&lt;description&gt;News for Nerds.  Stuff that Matters&lt;/description&gt;
      &lt;/channel&gt;
    
      &lt;image&gt;
    	&lt;title&gt;Slashdot&lt;/title&gt;
    	&lt;url&gt;http://slashdot.org/images/slashdotlg.gif&lt;/url&gt;
    	&lt;link&gt;http://slashdot.org&lt;/link&gt;
      &lt;/image&gt;
      
      &lt;item&gt;
    	&lt;title&gt;DVD CCA Battle Continues Next Week&lt;/title&gt;
    	&lt;link&gt;http://slashdot.org/article.pl?sid=00/01/12/2051208&lt;/link&gt;
      &lt;/item&gt;
      
      &lt;item&gt;
    	&lt;title&gt;Matrox to fund DRI Development&lt;/title&gt;
    	&lt;link&gt;http://slashdot.org/article.pl?sid=00/01/13/0718219&lt;/link&gt;
      &lt;/item&gt;
      
      &lt;item&gt;
    	&lt;title&gt;Mike Shaver Leaving Netscape&lt;/title&gt;
    	&lt;link&gt;http://slashdot.org/article.pl?sid=00/01/13/0711258&lt;/link&gt;
      &lt;/item&gt;
      
    &lt;/rdf:RDF&gt;</pre>
<p>
The attributes of the channel and image elements can be retrieved directly
from the plugin object using the familiar dotted compound notation:
</p>
<pre>    [% tt_start_tag %] news.channel.title  [% tt_end_tag %]
    [% tt_start_tag %] news.channel.link   [% tt_end_tag %]
    [% tt_start_tag %] news.channel.etc... [% tt_end_tag %]  </pre>
<pre>    [% tt_start_tag %] news.image.title    [% tt_end_tag %]
    [% tt_start_tag %] news.image.url      [% tt_end_tag %]
    [% tt_start_tag %] news.image.link     [% tt_end_tag %]
    [% tt_start_tag %] news.image.etc...   [% tt_end_tag %]  </pre>
<p>
The list of news items can be retrieved using the 'items' method:
</p>
<pre>    [% tt_start_tag %] FOREACH item = news.items [% tt_end_tag %]
       [% tt_start_tag %] item.title [% tt_end_tag %]
       [% tt_start_tag %] item.link  [% tt_end_tag %]
    [% tt_start_tag %] END [% tt_end_tag %]</pre>
[%- END %]
[% WRAPPER section
    title="AUTHORS"
-%]<p>
This plugin was written by Andy Wardley &lt;abw@kfs.org&gt;,
inspired by an article in Web Techniques by Randal Schwartz
&lt;merlyn@stonehenge.com&gt;.
</p>
<p>
The XML::RSS module, which implements all of the functionality that
this plugin delegates to, was written by Jonathan Eisenzopf 
&lt;eisen@pobox.com&gt;.
</p>
[%- END %]
[% WRAPPER section
    title="VERSION"
-%]<p>
2.51, distributed as part of the
Template Toolkit version 2.08, released on 30 July 2002.
</p>
[%- END %]
[% WRAPPER section
    title="COPYRIGHT"
-%]<pre>  Copyright (C) 1996-2002 Andy Wardley.  All Rights Reserved.
  Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.</pre>
<p>
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
</p>
[%- END %]
[% WRAPPER section
    title="SEE ALSO"
-%]<p>
[% ttlink('Template::Plugin', 'Template::Plugin') -%], [% ttlink('XML::RSS', 'XML::RSS') -%], [% ttlink('XML::Parser', 'XML::Parser') -%]
</p>
[%- END %]