Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2016-10-22 23:42 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (299 votes). Check out past polls.