Have this xml file to parse and code written for the same is
#!/usr/bin/perl
use XML::Simple qw(:strict);
use Data::Dumper;
my $file = 'tc1.xml';
my $data = XMLin($file, ForceArray => 1, KeyAttr =>{},);
#print Dumper($data);
foreach my $TestCase (@{$data->{TestCase}}){
print $TestCase->{Action}->{run_cmd}->[0], "\n"
}
____________________________________________
the sample xml is here.
<TestSuite>
<TestCase name="first">
<Action>
<run_cmd>cmd</run_cmd>
<Args>@arr1</Args>
<Prompt>ok</Prompt>
<Ret_values>reference1</Ret_values>
</Action>
<Action>
<run_cmd>cmd1</run_cmd>
<Args>@arr1</Args>
<Prompt>ok</Prompt>
<Ret_values>reference1</Ret_values>
</Action>
</TestCase>
<TestCase name="second">
<Action>
<run_cmd>cmd2</run_cmd>
<Args>@arr1</Args>
<Prompt>ok</Prompt>
<Ret_values>reference1</Ret_values>
</Action>
<Action>
<run_cmd>some_command</run_cmd>
<Args>@arr2</Args>
<Prompt>ok</Prompt>
<Ret_values>reference1</Ret_values>
</Action>
</TestCase>
</TestSuite>
___________________________________________________
however, I am not able to retrieve the contents of xml. the dumper statement
gives me hash but not able to get individual elements. I am seeing the error
"Out of Memory!" can someone please help me in troubleshooting this issue.
Also, If i do this instead, then out of memory error is gone, but still not
able to get the individual elements.
foreach my $TestCase (@{$data->{TestCase}->{Action}}){
print $TestCase->{Action}->{run_cmd}->[0], "\n"
}
please help.
--
thanks,
vy