diff options
Diffstat (limited to 'lib/Net')
-rw-r--r-- | lib/Net/HTTP/Spore/Middleware/Format/XML.pm | 18 |
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; |