|
This seems to do what I am looking for.. Thank you so much for your help mirod.
#!/usr/bin/perl -w
use strict;
use warnings;
use XML::Twig;
XML::Twig->new( twig_roots => { Comments => \&comments },
twig_print_outside_roots => 1,
keep_spaces => 1,
)
->parsefile( 'resume.xml');
exit;
sub comments {
my( $t, $comments) = @_;
if( $comments->field( 'Prompt')=~ m{Briefly describe your qualifications for this position}) {
my $response= $comments->first_child( 'Response');
if( $response) {
my $trncd = substr($response->text, 0, 1000);
$response->set_cdata( $trncd);
}
}
$t->flush;
}
|