summaryrefslogtreecommitdiff
path: root/lib/Net/HTTP/Spore/Middleware
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-11-25 18:03:02 +0100
committerfranck cuny <franck@lumberjaph.net>2010-11-25 18:03:02 +0100
commit90718d02219b79d358a349bd8e342b9f3b0d0115 (patch)
tree9838cbf0579c49e3b8d2abeb07c6e1df220428da /lib/Net/HTTP/Spore/Middleware
parentadd .gitignore (diff)
downloadnet-http-spore-90718d02219b79d358a349bd8e342b9f3b0d0115.tar.gz
allow XML::Simple options (fperrad)
Diffstat (limited to 'lib/Net/HTTP/Spore/Middleware')
-rw-r--r--lib/Net/HTTP/Spore/Middleware/Format/XML.pm18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/Net/HTTP/Spore/Middleware/Format/XML.pm b/lib/Net/HTTP/Spore/Middleware/Format/XML.pm
index a5a5743..85917ac 100644
--- a/lib/Net/HTTP/Spore/Middleware/Format/XML.pm
+++ b/lib/Net/HTTP/Spore/Middleware/Format/XML.pm
@@ -7,10 +7,24 @@ extends 'Net::HTTP::Spore::Middleware::Format';
use XML::Simple;
+my @KnownOptIn = qw(keyattr keeproot forcecontent contentkey noattr
+ searchpath forcearray cache suppressempty parseropts
+ grouptags nsexpand datahandler varattr variables
+ normalisespace normalizespace valueattr);
+
+my @KnownOptOut = qw(keyattr keeproot contentkey noattr
+ rootname xmldecl outputfile noescape suppressempty
+ grouptags nsexpand handler noindent attrindent nosort
+ valueattr numericescape);
+
sub accept_type { ( 'Accept' => 'text/xml' ); }
sub content_type { ( 'Content-Type' => 'text/xml' ) }
-sub encode { XMLout( $_[1] ) }
-sub decode { XMLin( $_[1] ) }
+sub encode { my $mw = $_[0];
+ my @args = map { $_ => $mw->{$_} } grep { $mw->{$_} } @KnownOptOut;
+ XMLout( $_[1], @args ) }
+sub decode { my $mw = $_[0];
+ my @args = map { $_ => $mw->{$_} } grep { $mw->{$_} } @KnownOptIn;
+ XMLin( $_[1], @args ) }
1;