P is for Practical | |
PerlMonks |
XML::Simple and <tag> </tag>by Jenda (Abbot) |
on May 18, 2004 at 17:50 UTC ( [id://354371]=perlquestion: print w/replies, xml ) | Need Help?? |
Jenda has asked for the wisdom of the Perl Monks concerning the following question: Is there any way to force XML::Simple to keep the spaces? prints I need the $data->{subtag} eq ' ', not ''. I tried to encode the space as  , but that did not make any difference. I also tried all other values of the suppressempty option, but that did not help. P.S.: It's quite possible there will be several spaces in the tag, I need them all! Update: I patched XML::Simple and added a new value for the suppressempty option that does what I need. Update:Actually the patch is incomplete, I need to get empty strings, not undefs for the completely empty tags. So I've added another option. ' ' = keep the spaces, return '' for empty tags vs. '0' = keep the spaces, return undef for empty tags. I'll post the updated patch later. If anyone has a better idea what values to use, I'm all ears :-) Jenda
Back to
Seekers of Perl Wisdom
|
|