in reply to Hash to XML with XML::Twig
Does it have to be XML::Twig?
use XML::Rules; my $parser = XML::Rules->new( rules => {}, ); print $parser->ToXML( data => { record => { id => 'B0001', section => [ 'Computer' ], title => [ 'PerlMonks' ], url => { target => '_blank', _content => 'http://www.perlmonks.org', } } }, 0, ' ', );
The unnamed arrays are there to make sure the section and title produce tags and not attributes. Another option would be to use section => {_content => 'Computer'}.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Hash to XML with XML::Twig
by sureerat (Acolyte) on Dec 02, 2008 at 17:59 UTC | |
by Jenda (Abbot) on Dec 02, 2008 at 23:31 UTC |