| 1 | =head1 NAME | ||
| 2 | |||
| 3 | Template::TAL::Output::XML - output templates as XML | ||
| 4 | |||
| 5 | =head1 SYNOPSIS | ||
| 6 | |||
| 7 | my $tt = Template::TAL->new( output => "Template::TAL::Output::XML" ); | ||
| 8 | print $tt->process('foo.tal'); | ||
| 9 | |||
| 10 | =head1 DESCRIPTION | ||
| 11 | |||
| 12 | This is a Template::TAL output filter that produces straight XML output | ||
| 13 | from the templates. | ||
| 14 | |||
| 15 | =cut | ||
| 16 | |||
| 17 | package Template::TAL::Output::XML; | ||
| 18 | use warnings; | ||
| 19 | use strict; | ||
| 20 | use Carp qw( croak ); | ||
| 21 | use base qw( Template::TAL::Output ); | ||
| 22 | |||
| 23 | use Encode; | ||
| 24 | |||
| 25 | sub render { | ||
| 26 | my ($self, $dom) = @_; | ||
| 27 | $dom->setEncoding( $self->charset ); | ||
| 28 | return Encode::encode( $self->charset, $dom->toString() ); | ||
| 29 | } | ||
| 30 | |||
| 31 | =head1 COPYRIGHT | ||
| 32 | |||
| 33 | Written by Tom Insam, Copyright 2005 Fotango Ltd. All Rights Reserved | ||
| 34 | |||
| 35 | This program is free software; you can redistribute | ||
| 36 | it and/or modify it under the same terms as Perl itself. | ||
| 37 | |||
| 38 | =cut | ||
| 39 | |||
| 40 | 1; |