Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

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;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://968603]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2018-05-26 18:47 GMT
Find Nodes?
    Voting Booth?