heinous amount of unwanted text
heinous amount of unwanted text
####
XML::Twig->new( twig_roots => { content => \&content }, twig_print_outside_roots => 1, keep_spaces => 1, ) ->parsefile( 'ginormous.xml');
exit;
sub text {
my( $t, $content) = @_;
my $snipped = substr($content->text, 0, 1000000);
$content->set_cdata($snipped);
$t->flush; }
####
my $field= 'content';
my $twig= new XML::Twig( twig_roots => { $field => 1 },
twig_print_outside_roots => 1,
twig_handlers => { $field => \&field } );
$twig->parsefile( "ginormous.xml");
sub field
{ my( $twig, $field)= @_;
$field->delete;
}