Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: XML::Simple isn't listening to SuppressEmpty

by Khen1950fx (Canon)
on May 03, 2012 at 01:14 UTC ( #968603=note: print w/ replies, xml ) Need Help??


in reply to XML::Simple isn't listening to SuppressEmpty

FWIW, I've experimented with XML::Simple for a couple of hours now, and, as far as I can see, SuppressEmpty doesn't work in this situation. I get the same results with or without it.

I triple-checked using Data::Serializer::Raw, Data::Dumper::Concise, and XML::Dumper. Also, I used use XML::Simple qw(:strict), and I used 'content' instead of '-content'. Here's what I have so far:
#!/usr/bin/perl -l use strict; use warnings; use Data::Dumper::Concise; use Data::Serializer::Raw; use XML::Simple qw(:strict); my $file = '/root/Desktop/xml2.xml'; open my $xml, '<', $file or die $!; binmode $xml, ":encoding(UTF-8)"; my $ref = XMLin( $xml, SuppressEmpty => undef, KeyAttr => { set => 'name' }, ForceArray => [ 'set' ], ContentKey => 'content', ); my $xml_raw_serializer = Data::Serializer::Raw->new( serializer => 'XML::Dumper' ); my $xml_data = $xml_raw_serializer->serialize($ref); print Dumper($xml_raw_serializer->deserialize($xml_data)); close $xml;


Comment on Re: XML::Simple isn't listening to SuppressEmpty
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://968603]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (16)
As of 2014-07-31 14:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (249 votes), past polls