doran has asked for the wisdom of the Perl Monks concerning the following question:
The following example illustrates the problem. It should print out the index of the last <record> node (in this case "1") but instead it gives an error. Remove or rename one of the pair of <id> tags and the script runs fine.
Any ideas?
Thanks,
Doran...
ps. I'm running perl v5.6
#! /perl/bin/perl -w use strict; use XML::Simple; my $file; { local $/=''; $file=<DATA>; } my $xml=XMLin("$file"); my $progress = $xml->{dbf}{progress}{record}; print $#$progress; __END__ <?xml version="1.0" standalone="yes"?> <escinfo> <dbf> <progress> <record> <title>11111</title> <id>abcd</id> </record> <record> <title>22222</title> <id>efgh</id> </record> </progress> </dbf> </escinfo>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML parsing trouble with id tags
by btrott (Parson) on Aug 02, 2000 at 04:12 UTC | |
|
Re: XML parsing trouble with id tags
by chip (Curate) on Aug 02, 2000 at 10:19 UTC | |
by doran (Deacon) on Aug 02, 2000 at 21:26 UTC |