in reply to Which module to use for writing XML file?

After struggling for a while with XML::Simple I finally found XML::LibXML quite easy to work with. It's somewhat low level, but at least it does exactly what you mean.
For instance, this simple sub builds XML from a hash in my latest application :
sub build_document { #****f* build_document # USAGE # build_document(docroot=>{}.,..) # EXAMPLE # build_document( # entrepot => { # oper => "titi", # status => "OK", # }, # param => { # role => "user", # text => "toto", # }, # target => { # name => "target", # sender => "envoyeur", # }, # uri => { # text => "URI", # }, # comment => { # text => "comment?" # } # ); #*** my %param; tie %param, "Tie::IxHash"; %param = @_; my ( $rootelem, $rootval ) = ( each %param ); delete $param{$rootelem}; my $doc = XML::LibXML->createDocument( "1.0", "ISO-8859-1" ); # root my $root = $doc->createElement($rootelem); $doc->setDocumentElement($root); # attributs du root while ( my ( $k, $v ) = each %$rootval ) { $root->setAttribute( $k, $v ); } # élements fils while ( my ( $k, $v ) = each %param ) { my $elem = $doc->createElement($k); while ( my ( $subk, $subv ) = each %{$v} ) { if ( $subk eq 'text' ) { # conversion du contenu en UTF-8 Unicode::String->stringify_as('utf8'); $subv = Unicode::String::latin1($subv); my $text = XML::LibXML::Text->new($subv); $elem->addChild($text); } else { $elem->setAttribute( $subk, $subv ); } } $root->addChild($elem); } return $doc->toString(1); }

updated : added readmore tags. In case you're wondering, the documentation is in ROBODoc format.