XML parsen mit perl
Martin Gründer
marting at sungurus.de
Mon Aug 27 16:20:38 CEST 2007
Dank meines Kollegen Hajo Köhlers habe ich das Problem dann auch verstanden.
Der Dumper ist hier sehr hilfreich zu verstehen, was xml::simple da macht.
Und Hajo hat dann auch gleich eine Lösung parat (per Array), vielleicht
hilfts:
#!/usr/bin/perl -w
use XML::Simple;
use Data::Dumper;
$xml = new XML::Simple;
$data = $xml->XMLin("$ARGV[0]", ForceArray => 1);
##print Dumper $data;
foreach $c (@{$data->{cache}} ) {
##print Dumper $c->{waypoints}->[0]->{oc};
print $c->{waypoints}->[0]->{oc} ."\n";
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 370 bytes
Desc: OpenPGP digital signature
URL: <http://lug-owl.de/pipermail/linux/attachments/20070827/ec6e42f0/attachment.sig>
More information about the Linux
mailing list