[Chicago-talk] XML::Simple MXLout SuppressEmpty

Michael D. Stemle, Jr. manchicken at notsosoft.net
Wed Sep 27 20:47:51 PDT 2006


You may have to just weed it out manually...  I've never figured out how to 
get that to work...

On Wednesday 27 September 2006 14:59, tiger peng wrote:
> Hello all,
>
> Is there simple way to avoid an empty hash being shown
> up as an empty element in XML with XML::Simple?
> According to perldoc XML::Simple, the SuppressEmpty
> only work for undef in XMLout.
>
> print Dumper($tree);
> print XMLout($tree, SuppressEmpty => 1);
>
> $VAR1 = {
>   'category' => {
>     '301994' => {
>       'level' => 2,
>       'categroy' => {},
>       'name' => Furniture',
>       'code' => '301994'
>       }
>     }
> };
> <opt>
>   <category name="Furniture" code="301994" level="2">
>     <categroy></categroy>
>   </category>
> </opt>
>
> #Here is my ugly work-around:
>  print XMLout(XMLin(XMLout($tree), SuppressEmpty =>
> 1));
> <opt>
>   <category name="Furniture" code="301994" level="2"
> />
> </opt>
>
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk

-- 
~ Michael D. Stemle, Jr. <><
(A)bort, (R)etry, (I)nfluence with large hammer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/chicago-talk/attachments/20060927/306b0441/attachment.bin 


More information about the Chicago-talk mailing list