in reply to Re: Parsing with XML::Simple
in thread Parsing with XML::Simple
#!/usr/bin/perl use strict; use warnings; use XML::Simple; use Data::Dumper; use Data::Dump 'pp'; #my $content = $response->decoded_content(); my $content = qq|<?xml version=\'1.0\' encoding=\'UTF-8\'?><soap:Envel +ope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header><ais:requestID xmlns:ais="http://com"> {7f000001-47db2420000001569783cdb88136} </ais:requestID> </soap:Header> <soap:Body> <soap:Fault> <faultcode>soap:Server</faultcode> <faultstring> check expression: </faultstring> <faultactor>CheckTwo</faultactor> <detail> <longDescription xmlns="http://com"> Exception occurred </longDescription> <MaxCode xmlns="http://com/Server">-2225</MaxCode> </detail> </soap:Fault> </soap:Body> </soap:Envelope>|; #my $parser = new XML::Simple; my $parser= XML::Simple->new( KeepRoot => 1, KeyAttr => [], ForceArray + => [qw( MaxCode )] ); my $data = $parser->XMLin($content); my $result = $data->{'soap:Body'}->{'soap:Fault'}->{'detail'}->{'MaxCo +de'};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Parsing with XML::Simple
by Mr. Muskrat (Canon) on Aug 23, 2016 at 19:33 UTC | |
by Anonymous Monk on Aug 23, 2016 at 19:55 UTC |