From: Rob Dixon <[EMAIL PROTECTED]> > I am unfamiliar with XML::Generator, but have experimented with it for > the purposes of your question and it seems to be essentially a translator > that will convert a Perl fragment into an XML fragment, and I can see no > way to modify existing XML. Because of this it seems extremely limited in > its application, as you would have to write > > my $xml = $gen->users( > $gen->user({id => 10}, 'dermot'), > $gen->user({id => 17}, 'joe'), > : > ); > > to create your desired output, which simply moves your problem to one of > how to generate the Perl from your data in the first place. If someone > on the list is familiar with XML::Generator then please correct me if I > am wrong.
It's just a matter of one map(): #!perl use XML::Generator; $ref = { 'dermot' => '10', 'joe' => '17', 'rose' => '11', 'phil' => '13', 'brian' => '20', 'andy' => '15', }; my $gen = XML::Generator->new(':pretty'); my $xml = $gen->users( map { $gen->user({id => $ref->{$_}}, $_) } keys %{$ref} ); print $xml; __END__ Jenda ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/