K
kj
Hi. Does anyone know of a module that will take a suitable Python
dictionary and return the corresponding XML structure?
In Perl I use XML::Simple's handy XMLout function:
use XML::Simple 'XMLout';
my %h = ( 'Foo' => +{
'Bar' => +{
'Baz' => [ { 'meenie' => 3 },
{ 'meenie' => 7 } ],
'eenie' => 4,
},
'minie' => 1,
'moe' => 2,
} );
print XMLout( \%h, KeepRoot => 1, KeyAttr => undef );
__END__
<Foo minie="1" moe="2">
<Bar eenie="4">
<Baz meenie="3" />
<Baz meenie="7" />
</Bar>
</Foo>
Is there a Python module that can do a similar conversion from
a Python dict to an XML string?
(FWIW, I'm familiar with xml.marshal.generic.dumps, but it does
not produce an output anywhere similar to the one illustrated
above.)
TIA!
Kynn
dictionary and return the corresponding XML structure?
In Perl I use XML::Simple's handy XMLout function:
use XML::Simple 'XMLout';
my %h = ( 'Foo' => +{
'Bar' => +{
'Baz' => [ { 'meenie' => 3 },
{ 'meenie' => 7 } ],
'eenie' => 4,
},
'minie' => 1,
'moe' => 2,
} );
print XMLout( \%h, KeepRoot => 1, KeyAttr => undef );
__END__
<Foo minie="1" moe="2">
<Bar eenie="4">
<Baz meenie="3" />
<Baz meenie="7" />
</Bar>
</Foo>
Is there a Python module that can do a similar conversion from
a Python dict to an XML string?
(FWIW, I'm familiar with xml.marshal.generic.dumps, but it does
not produce an output anywhere similar to the one illustrated
above.)
TIA!
Kynn