#!/usr/bin/perl -- use Path::Tiny qw/ path /; use Data::Dump qw/ dd /; use XML::Twig; my $infile = 'twiggy-test.xml'; my $outfile = 'twiggy-WHAT.xml'; dd( path( $infile )->slurp_utf8 ); getTwiggy( $infile , $outfile ); dd( path( $outfile )->slurp_raw ); sub getTwiggy { # set up the XML parser: my $twig= XML::Twig->new( comments => 'keep', # keep_encoding => 1, keep_spaces=> 1, twig_handlers => { li => sub_ix_strings($infile), }, ); $twig->parsefile($infile); print " Saving $outfile...\n"; open(NEW,">$outfile") || die("cannot open file $outfile for writing.\n"); $twig->flush( \*NEW); close(NEW); } sub sub_ix_strings { my($file) = @_; return sub { my($twig,$elt) = @_; $elt->set_att('test',"hello"); } } __END__ #### The ISO character set

Each ISO character has its own value, except that lowercase characters are translated to uppercase. Two characters that have no uppercase equivalent are:

  • German small sharp s (ß - 0xDF)
  • Lowercase y diaeresis/umlaut (ÿ - 0xFF)