Thomas R Wyant_III wrote:

<snip>

The things that XML::Simple will lose for you include:


<snip>

* The order of duplicate tags (e.g. multiple <Member> tags).


Does this mean that contents of the value array in the code below could be out of order? I ran it through 100000 <value></value> tags and I couldn't find one out of order. I could see that the tags could be messed up if I ran the hash through a XMLout..

#!/usr/bin/perl -w

use XML::Simple;

my $xmltext = '<begin><another>';

foreach my $i (0 .. 100000)
{
$xmltext .= "<value>$i</value>";
}

$xmltext .= '</another></begin>';

my $xs = new XML::Simple(suppressempty => undef);

#save a reference of the hash to $upperref.
my $upperref = $xs->XMLin($xmltext);

print "looking for a number out of sequence\n";
my $last_number = -1;
my $count = 0;
foreach my $j (@{$upperref->{another}{value}})
{
unless (($j - $last_number) == 1)
{
print "Error: $j is out of order\n" ;
$count ++;
}
$last_number = $j;
}

print "There are $count objects out of order\n";


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to