[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[4745] trunk/LedgerSMB



Revision: 4745
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4745&view=rev
Author:   einhverfr
Date:     2012-05-22 06:58:29 +0000 (Tue, 22 May 2012)
Log Message:
-----------
XML format handler for RESTful web services

Added Paths:
-----------
    trunk/LedgerSMB/REST_Format/
    trunk/LedgerSMB/REST_Format/xml.pm

Added: trunk/LedgerSMB/REST_Format/xml.pm
===================================================================
--- trunk/LedgerSMB/REST_Format/xml.pm	                        (rev 0)
+++ trunk/LedgerSMB/REST_Format/xml.pm	2012-05-22 06:58:29 UTC (rev 4745)
@@ -0,0 +1,36 @@
+=head1 NAME
+
+LedgerSMB::REST_Format::xml - XML file support for LedgerSMB RESTful web 
+services.
+
+=head1 SYNOPSYS
+
+
+my $hash = LedgerSMB::REST_Format::xml::from_input($request);
+my $xml = LedgerSMB::REST_Format::xml::to_output($request);
+
+=head1 COPYRIGHT 
+
+Copyright (C) 2012 The LedgerSMB Core Team.
+
+This file may be used under the terms of the GNU General Public License 
+version 2 or at your option any later version.  Please see the included
+LICENSE.TXT file.
+
+=cut
+
+use XML::Simple;
+use strict;
+use warnings;
+
+sub from_input{
+    my $request = shift @_;
+    return XMLin($request->{payload}, ForceArray=>1);
+}
+
+sub to_output{
+    my $request = shift @_; 
+    return XMLout($request->{payload}, RootName => $request->{class_name});
+}
+
+1;

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.