in reply to Parsing with XML::Simple
Don't! Please see this post for reasons.
Also the number is not in any ErrorCode tag, but in <MaxCode> in namespace http://com/Server !
# if you don't care where in the structure is the tag, this would be s +ufficient: use strict; use warnings; use XML::Rules; my $parser = XML::Rules->new( namespaces => { 'http://schemas.xmlsoap.org/soap/envelope/' => 'soap', 'http://com/Server' => 'srv', 'http://com' => 'com' }, rules => { 'srv:MaxCode' => sub { my ($attrs, $parser) = @_[1,4]; $parser->return_this($attrs->{_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 $result = $parser->parse($content); print $result;
Jenda
Enoch was right!
Enjoy the last years of Rome.
|
|---|