in reply to Re^3: XML::Simple for sequence in xsd
in thread XML::Simple for sequence in xsd
use strict; use warnings; use Tie::IxHash; use XML::Simple; my %myhash; tie %myhash, 'Tie::IxHash'; $myhash{foo1} = 'bar1'; $myhash{foo3} = 'bar3'; $myhash{foo2} = 'bar2'; $myhash{foo4} = 'bar4'; $myhash{foo5} = [qw(bar5a bar5b bar5c)]; print XMLout(\%myhash, NoSort => 1);
And the output:
<opt foo1="bar1" foo3="bar3" foo2="bar2" foo4="bar4"> <foo5>bar5a</foo5> <foo5>bar5b</foo5> <foo5>bar5c</foo5> </opt>
And without the tie:
<opt foo3="bar3" foo4="bar4" foo2="bar2" foo1="bar1"> <foo5>bar5a</foo5> <foo5>bar5b</foo5> <foo5>bar5c</foo5> </opt>
Alternatively the data could be written with XML::Twig or other XML modules.
|
|---|