in reply to parsing various xml responses
$ cat t.pl #!/usr/bin/perl # vim: set ts=8 sw=2 et: use strict; use warnings; use XML::Bare; use Data::Dump qw/dump/; my $page = <<XML; <?xml version="1.0" encoding="ISO-8859-1" ?> <PayoneerResponse> <Echo> <Status>000</Status> <Description>Echo Ok - All systems are up.</Description> </Echo> </PayoneerResponse> XML my $ob = new XML::Bare( text => $page ); my $root = $ob->parse(); print "here comes the description:\n"; print $root->{PayoneerResponse}{Echo}{Description}{value}; print "\n\nand here's a dump of \$root:\n"; print dump $root; $ ./t.pl here comes the description: Echo Ok - All systems are up. and here's a dump of $root: { PayoneerResponse => { Echo => { Description => { _i => 95, _pos => 4, _z => 149, value = +> "Echo Ok - All systems are up." }, Status => { _i => 73, _pos => 3, _z => 91, value => "000 +" }, _i => 66, _pos => 2, _z => 158, value => "\n", }, _i => 47, _pos => 1, _z => 178, value => "\n", }, _i => -273705520, _pos => 0, _z => 0, value => " \n", }
Are you using the {value} key?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: parsing various xml responses
by Anonymous Monk on Dec 14, 2009 at 02:37 UTC | |
by Anonymous Monk on Dec 14, 2009 at 02:54 UTC | |
by Anonymous Monk on Dec 14, 2009 at 03:07 UTC |