in reply to XML SOAP Response
Try adding this at the end of your program.
my @vehicles; foreach (@{$data->{Vehicles}->{Vehicle}}) { my %vehicle; $vehicle{vin}=$_->{vin}; foreach(@{$_->{VehicleAttributes}->{VehicleAttribute}}) { $vehicle{$_->{type}}=$_->{value}; } push(@vehicles,\%vehicle); } print Dumper(\@vehicles);
Updated: corrected several errors, now it works. You have to replace the initialization of $xml with
my $xml = new XML::Simple( ForceArray => ["Vehicle"]);to force the "Vehicle" tag in your XML to became an array in the generated tree.
Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: XML SOAP Response
by mitchismoney (Initiate) on Jul 31, 2008 at 17:46 UTC | |
by almut (Canon) on Jul 31, 2008 at 17:55 UTC | |
by psini (Deacon) on Jul 31, 2008 at 18:23 UTC | |
Re^2: XML SOAP Response
by psini (Deacon) on Jul 31, 2008 at 17:49 UTC |
In Section
Seekers of Perl Wisdom