Hi all,
I am using XML::Simple (can't use updated modules like XML::LibXML at this point) to read in a xml and get the values in variables to compare.
The following element is giving me hard time though:
$VAR1 = {
'cmts' => {
'STBDSG' => {
'dsg' => [
{
'tag1' => '1',
'tag2' => 'caSystemId',
},
{
'tag1' => '2',
'tag2' => 'gaSystemId',
}
]
},
I am trying to read values of tag1 and tag2 in distinct variables and have tried few options one of which is:
my $dsg_tags = $xst->{cmts}->{STBDSG}->{dsg};
for my $dsg (@$dsg_tags) {
print "Value of tag1 :";
print $dsg->{tag1}, "\n";
print "Value of tag2 :";
print $dsg->{tag2}, "\n";
}
There are no compilation errors but nothing is printed when I run the script even though tag1, tag2 have values after xml is parsed.
I am parsing xml using:
my $xst;
if((not defined $xml) or ($xml =~ m/read\stimeout/i)){
&printXMLErr('request timed out');
} else {
my $xs = XML::Simple->new();
$xst = eval { $xs->XMLin($xml,KeyAttr=>1) };
&printXMLErr($@) if($@);
}
Can you please help me if I am missing something here and suggest me how to correct it. I am also trying to find from net and CPAN documentation.
Thanks in advance!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.