#!/usr/bin/perl
use XML::DT ;

%handler=(
  -outputenc => 'ISO-8859-1',
  -type =>   {   chaves     => "SEQ",
                 classes    => "SEQ",
                 descs      => "SEQ",
                 gloss      => "MAP"},
  -default  => sub {$c},
  chave     => sub {toxml},
  descricao => sub {toxml},
  classe    => sub {toxml},
  gloss     => sub { my $r="";
    while(my $a = shift(@{$c->{chaves}}). 
                  shift(@{$c->{classes}}). 
                  shift(@{$c->{descs}})){ $r .= toxml("termo",{},$a)}
    toxml("gloss",{},$r); });

print dt(shift, %handler);             # sem ter cuidado com formatacoes...
