use warnings; use strict; use XML::Twig; my $twig = new XML::Twig( twig_handlers => { 'REF' => \&REF } ); $twig->parsefile("AFP_ENG_20050316.0102.xml"); #Parse the file $twig->print(); sub REF { my ( $twig, $field ) = @_; my $ref_text = $field->text(); my $ref_ext = $field->att('EXT'); $field->set_text($ref_ext) if $ref_ext; }
You can try to use the cut method to remove elements.
In reply to Re^5: Search and Replace in XML
by toolic
in thread Search and Replace in XML
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |