in reply to Hash to XML

use strict; use XML::Simple; my $xs = new XML::Simple; my %DATA = ( 'link2' => { 'attribute' => { 'x' => '0050', 'y' => '0050', 'r' => '100' }, 'src' => 'http://foo.com/4158.swf', 'colours' => { 'alpha' => '000' }, 'name' => 'Future truth oracle' } ); # it's the 'noattr' option that is important here my $xml = $xs->XMLout(\%DATA, noattr => 1); print $xml;

Output:

<opt> <link2> <attribute> <x>0050</x> <y>0050</y> <r>100</r> </attribute> <src>http://foo.com/4158.swf</src> <colours> <alpha>000</alpha> </colours> <name>Future truth oracle</name> </link2> </opt>

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Replies are listed 'Best First'.
Re: (Ovid) Re: Hash to XML
by ropey (Hermit) on Mar 27, 2002 at 09:58 UTC
    Superb, Did the trick nicely !! Many thanks folks !!