hello ateague.
Sometimes I met the case when pretty print doesn't work with XML::Twig. If pretty print is the problem, how about this?
XML::Twig->new(
twig_handlers => {
'statement' => sub {
my($twig,$elt)=@_;
if( $elt->find_nodes('primary/acct', 0)->trimmed_text() eq
+ '903264' ){
$twig->flush;
}else {
$twig->purge;
}
},
'statement//*' =>sub {}, #skip descendants of statement
'_default_' => sub { #just flush
my($twig,$elt)=@_;
$twig->flush;
}
},
#twig_print_outside_roots =>1,
pretty_print => 'indented',
)->parse(*DATA);
__DATA__
same data
This prints pretty with my XML::Twig
C:\temp>perl -MXML::Twig -e "print $XML::Twig::VERSION"
3.42
This example be "potato", becuase it kills the advantage to use twig_root.
good luck.