[Templates] Template::Plugin::XML::Writer

Perrin Harkins perrin@elem.com
Tue, 11 Jul 2006 11:32:00 -0400


On Tue, 2006-07-11 at 14:33 +0100, Addison, Mark wrote:
> =head1 SYNOPSIS
> 
>     # Load the plugin and set writer options.
>     [% xw = XML.Writer( DATA_MODE => 1, DATA_INDENT => 2 ); %]
> 
>     # Create XML document
>     [%
>         xw.xmlDecl;
>         xw.startTag( 'website', id=>'webzone1' );
>         xw.comment( 'Website description' );
>         xw.startTag( 'section', name=>'alpha', title=>'The Alpha Zone'
> );
>         xw.dataElement( 'description', 'Hello...' );
>         xw.emptyTag( 'page', href=>'/foo/bar', title=>'The Foo Page' );
>         xw.emptyTag( 'page', href=>'/bar/baz', title=>'The Bar Page' );
>         xw.emptyTag( 'page', href=>'/baz/qux', title=>'The Baz Page' );
>         xw.endTag;
>         xw.endTag;
>         xw.end;
>     %]

I don't get it.  Why would you use this from a template?  All you're
doing is calling methods.  Wouldn't this code be better off as a simple
perl script?

- Perrin