Element missing after parsing XML using XML::Twig's simplify

61 views Asked by At

Following code parses a simple test.xml:

my $twig = XML::Twig->new();
my $file = 'test.xml';
my $Hash = $twig->parsefile($file)->simplify();
print Dumper($Hash);

test.xml:

<entry>
<string>SYNMAKE_LOCATION</string>
<string/>
</entry>

output:

$VAR1 = {
          'string' => [
                      {}
                    ]
        };

the expect output is:

$VAR1 = {
          'string' => [
                      'SYNMAKE_LOCATION',
                      {}
                    ]
        };

Can anyone help me find what is wrong with my code?

1

There are 1 answers

0
choroba On

It seems simplify doesn't work.