| Catalyst-View-XML-Generator documentation | Contained in the Catalyst-View-XML-Generator distribution. |
Catalyst::View::XML::Generator - Serialize the stash as XML using XML::Generator::PerlData
Version 0.02
__PACKAGE__->config(
'XML::Generator' => {
rootname => 'document',
attrmap => {
action => [qw( class name )],
view => [qw( type )]
}
}
);
This Catalyst view renders the context stash as XML using XML::Generator::PerlData. This enables you to quickly render customized XML output using a set of rules to dictate which hash parameters will be stored as attributes, elements, and other configuration options.
Michael Nachbaur, <mike@nachbaur.com>
Please report any bugs or feature requests to bug-catalyst-view-xml-generator at rt.cpan.org, or through
the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-View-XML-Generator. I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc Catalyst::View::XML::Generator
You can also look for information at:
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Catalyst-View-XML-Generator
Copyright (c) 2009 Michael Nachbaur
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Catalyst-View-XML-Generator documentation | Contained in the Catalyst-View-XML-Generator distribution. |
package Catalyst::View::XML::Generator; use Moose; BEGIN { extends 'Catalyst::View' } use XML::SAX::Writer; use XML::Generator::PerlData; use namespace::clean;
our $VERSION = '0.02';
sub process { my ($self, $c) = @_; my $conf = $c->config->{'View::XML'}; my $content = ''; my $builder = XML::SAX::Writer->new(Output => \$content); my $generator = XML::Generator::PerlData->new( Handler => $builder, %{ $conf } ); my $dom = $generator->parse($c->stash); $c->response->content_type("text/xml"); $c->response->body($content); 1; }
1;