Subject: | expanded greater than symbol entity > not preserved in parse |
XML file that contains < and > entities, only < is preserved
and > converted to >.
<code>
use strict;
use warnings;
use XML::Twig;
use Data::Dump qw' dd ';
Main( @ARGV );
exit (0);
sub Main {
my %files;
my $filename;
my $subprint = sub {
my( $twig, $_ ) = @_;
push @{ $files{ $filename }}, $_->sprint;
return;
};
my $twig = XML::Twig->new(
ignore_elts => { brief => 'discard', detailed => 'discard' },
pretty_print => 'indented',
TwigHandlers => {
'myroot/classes' => $subprint,
},
);
for my $file( @_ ) {
$filename = $file;
eval {
$twig->safe_parsefile( $file );
1;
} or warn "ERROR parsefile($file): $@ ";
$twig->purge;
}
dd \%files;
}
</code>
XML file
<code>
<?xml version='1.0' standalone='yes'?>
<myroot>
<classes name="SomeClass::AccessLogic">
<public_typedefs>
<members name="Ptr" kind="typedef" type="boost::shared_ptr< BAR
>" virtualness="non_virtual">
<brief></brief>
<detailed></detailed>
</members>
</public_typedefs>
</classes>
</myroot>
</code>