#!/usr/bin/perl use XML::DT ; my $filename = shift; %handler=( '-outputenc' => 'ISO-8859-1', '-type' => {poeta => "MAP", a => "MAP", }, 'nome' => sub{$c}, #Put the atributes and $c map in the atributes of the father 'a' => sub{%{$dtatributes[1]} = (%v,%$c);"";}, #get the atributes "autor" from the father 'poema' => sub{toxml("poema",{aut=>$dtatributes[1]{autor}},$c)}, 'autor' => sub{$c}, 'periodo' => sub{$c}, 'poeta' => sub{toxml("poeta",{%v,%$c},"");},# remember $v{id},$v{name} ); print dt($filename,%handler); __END__ . use of toxml as a paremetrized xml writer . use father atributes to pass information btween brothers . using @dtatributes