hakana has asked for the wisdom of the Perl Monks concerning the following question:
<exec> <dut> <tc id="001.001" result="Passed" <ts .../> ... </tc> <tc id="002.001" result="Failed" <ts .../> ... </tc> ... </dut> </exec> ### use XML::Simple; my $Macaddress = param("macaddress"); my $conf = "/home/ember/devices/$Macaddress/$Macaddress.xml"; # create object my $xmlfile = new XML::Simple (ForceArray=>1); $xml = $xmlfile->XMLin($conf); $Passed = 0; $Warnings = 0; $Failed = 0; foreach my $TCresult (@{$xml->{tc}}){ if ($TCresult->{result} eq 'Passed'){$Passed++;} if ($TCresult->{result} eq 'Warnings'){$Warnings++;} if ($TCresult->{result} eq 'Failed'){$Failed++;} }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Simple parse attributes
by hipowls (Curate) on Jan 29, 2008 at 10:21 UTC | |
by hakana (Acolyte) on Jan 29, 2008 at 12:44 UTC | |
|
Re: XML::Simple parse attributes
by shmem (Chancellor) on Jan 29, 2008 at 10:30 UTC | |
|
Re: XML::Simple parse attributes
by moritz (Cardinal) on Jan 29, 2008 at 10:22 UTC | |
|
Re: XML::Simple parse attributes
by olus (Curate) on Jan 29, 2008 at 11:15 UTC | |
|
Re: XML::Simple parse attributes
by Jenda (Abbot) on Feb 06, 2008 at 00:42 UTC |