CatalystX::Usul::View::XML - Render XML response to an XMLHttpRequest


CatalystX-Usul documentation Contained in the CatalystX-Usul distribution.

Index


Code Index:

Name

Top

CatalystX::Usul::View::XML - Render XML response to an XMLHttpRequest

Version

Top

0.3.$Revision: 576 $

Synopsis

Top

   MyApp->config( "View::XML"   => {
                     base_class => qw(CatalystX::Usul::View::XML) } );

Description

Top

The XML view is used to generate fragments of XML in response to Javascript XMLHttpRequests from a client that has selected this as the required content type

Subroutines/Methods

Top

deserialize

Deserializes the supplied data

serialize

Returns the supplied data encoded as XML

Diagnostics

Top

None

Configuration and Environment

Top

None

Dependencies

Top

Catalyst::View
XML::Simple

Incompatibilities

Top

There are no known incompatibilities in this module

Bugs and Limitations

Top

There are no known bugs in this module. Please report problems to the address below. Patches are welcome

Author

Top

Peter Flanigan, <Support at RoxSoft.co.uk>

License and Copyright

Top


CatalystX-Usul documentation Contained in the CatalystX-Usul distribution.

# @(#)$Id: XML.pm 576 2009-06-09 23:23:46Z pjf $

package CatalystX::Usul::View::XML;

use strict;
use warnings;
use version; our $VERSION = qv( sprintf '0.3.%d', q$Rev: 576 $ =~ /\d+/gmx );
use parent qw(CatalystX::Usul::View);

use Class::C3;
use XML::Simple;

__PACKAGE__->config( deserialize_attrs => { ForceArray => 0 } );

sub deserialize {
   my ($self, @rest) = @_; my $process;

   $process = sub { return XML::Simple->new( %{ $_[0] } )->xml_in( $_[1] ); };

   return $self->next::method( @rest, $process );
}

sub serialize {
   my ($self, $attrs, $data) = @_;

   return XML::Simple->new( %{ $attrs } )->xml_out( $data );
}

1;

__END__

# Local Variables:
# mode: perl
# tab-width: 3
# End: