Dermot Paikkos said:
> On 3 Nov 2005 at 7:45, Scott Taylor wrote:
>>
>> Hi All,
>>
>> I'm using XML::Simple to parse a very simple XML file and dump the data
>> into hashes of hashes.
>>
>> The problem I'm getting, is sometimes information is blank in the XMl
>> file; it looks like this:
>> <STREETNUM/>
>> instead of
>> <STREETNUM>1234</STREETNUM>
>>
>> and when I print the hash:
>>
>> print "$x->{VEHICLE}->{STREETNUM} ";
>>
>> it returns: "HASH(blahblah)";
>>
>> How do I test for this so it prints blank?  I've tried many things, the
>> most logical I could think of was:
>>
>> if ($x->{VEHICLE}->{STREETNUM}){ print ... }
>> else { print ""; }
>>
>> but even that doesn't work.
>>
>> Cheers.
>>
>
> Not sure if I am qualified enough to answer this but I have had a bit
> of experience with XML::Simple. I would recommend using
> my $x = XMLin($fh, ForceArray => 1);

That seems to have made a worse mess.  Somehow ends up in a huge loop. :(

> I would also say that the source file is wrong, it should read
> <STREETNUM></STREETNUM>

I read somewhere that <blah /> is correct syntax (same as <blah></blah>)
but that doesn't mean that XLM::Simple likes it any better.

Unfortunately, I can't change the input file much.

Relly all I am looking for is a way to test if a Hash has a legitimate
value in it, or is it going yo output that way.

Thanks for your help.

--
Scott

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to