Seems my brain is rather fritzed on this problem right now. I have this hash (from Data::Dumper and shortened for clarity):
Which I need to convert to XML that looks like this:$VAR1 = { 'campaign' => { 'menuid' => '10118', 'action' => 0, 'phonenumbers' => [ { 'phonenumber' => { 'number' => '9163723752' } }, { 'phonenumber' => { 'number' => '9166413900' } } ] } };
But which comes out like this:<campaign action="0" menuid="10118"> <phonenumbers> <phonenumber number="9163723752" /> <phonenumber number="9166413900" /> </phonenumbers> </campaign>
My code looks like this:<campaign action="0" menuid="10118"> <phonenumbers name="phonenumber" number="9163723752" /> <phonenumbers name="phonenumber" number="9166413900" /> </campaign>
But it seems to make no difference what I do with the ForceArray option at all!print Dumper $xml_hash; my $xml_obj = XML::Simple->new( Keeproot => 1, ForceArray => 1); my $xmlo = $xml_obj->XMLout( $xml_hash ); print $xmlo;
Any help appreciated! jdtoronto
In reply to Yet another XML::Simple question! by jdtoronto
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |