in reply to [SOLVED] XML::Twig's twig_print_outside_roots adds extra blank lines to output
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?
This prints pretty with my XML::TwigXML::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 example be "potato", becuase it kills the advantage to use twig_root.C:\temp>perl -MXML::Twig -e "print $XML::Twig::VERSION" 3.42
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: XML::Twig's twig_print_outside_roots adds extra blank lines to output
by ateague (Monk) on Jun 30, 2014 at 00:22 UTC |