Hi, I create one XML file which has certain steps of testcases.
<?xml version='1.0'?> <config> <Testcaseid step1="MTPconfiguration.pl" step2="MTPCheckState.pl" step3 +="TM500_RCI.py" step4="ParseTM500Logs.pl" step5="ParseMTPlogs.pl" /> <Testcaseid step1="MTPconfiguration.pl" step2="MTPcheckstateATTN.pl" s +tep3="TM500_RCI.py" step4="ParseTM500log.pl" step5="ParseMTPlogs.pl" +/> </config>
Now i want to read those steps in perl file in a loop. I am trying like the code which i mentioned below. But the problem is as the steps are storing as a hash, i am not able to access in order. for example, 1st it should print in the order as step1, step2, step3...so on but it is printing as step2, step1, step3, step5,step4.... if the content in xml file is written in text file, i am not able to access those values from the text file in perl file. Any help would be appreciated. Thanks in advance
use strict; use warnings; use XML::Simple; use Data::Dumper; my $XML = XMLin("C:\\Users\\Administrator\\Desktop\\Sample\\VERSION2\\ +testcase.xml"); my $testcaseid=$XML->{Testcaseid}; print Dumper(\$testcaseid); my ($testcase,$teststep,$key,$steps); while (($testcase,$teststep)=each @{$testcaseid}){ foreach my $steps (values %{$teststep}) { print "$steps\n"; } }
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |