On 23 Oct 2007 at 12:12, Rob Coops wrote: > foreach my $k (keys %{$ref}) { > $xml = $gen->users( # $xml gets over written with every new > key.... So instead of doing that I would try $xml .= (appending) > $gen->username({ id => $ref->{$k}},$k), > ); > } >
Perhaps I should have mentioned that I had tried that and the result is empty XML like this my $gen = XML::Generator->new(':pretty'); my $xml; foreach my $k (keys %{$ref}) { $xml .= $gen->users( $gen->username({ id => $ref->{$k}},$k), ); } </users><users>---- This seems to work but my browser is complaining about the output: "XML Parsing Error: junk after document element" The source looks out but there is no root level element. my $xml; foreach my $k (keys %{$ref}) { $xml .= $gen->username({ id => $ref->{$k}},$k); } print $xml; So it's close but not quite there. Dp. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/