Hello Bruce
Take a closer look at the docs, and try
my $xml = XMLin($data, SuppressEmpty => undef);
HTH,
Rob
Bruce Ferrell wrote:
I have a wee problem I can seem to solve. I don't want to get into
should XML::Simple be used, it's not relevant to my question... I don't
think. Below is some very simple XML and below that the output after
passing it through Dumper.
As you can see phone2 is a blank tag (no contents) and it has the oddest
representation in the Dumper output. How do I detect that?
my $xml = XMLin ($data, ForceArray => 0)
For non-blank tags <phone1></phone1> / $xml->{message}->{phone1} works
fine. for a blank tag, I get other less interesting data.
Suggestions?
<event>
<type>ADD</type>
<message>
<msgtype>PHONE</msgtype>
<phone1>15105551212</phone1>
<phone2></phone2>
<wav>YES</wav>
<custID>digits</custID>
<status>ALERT</status>
</message>
</event>
$VAR1 = {
'type' => 'ADD',
'message' => {
'status' => 'ALERT',
'phone1' => '15105551212',
'custID' => 'digits',
'phone2' => {},
'wav' => 'YES',
'msgtype' => 'PHONE'
}
};
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/