in reply to Re^4: Search and Replace in XML
in thread Search and Replace in XML
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Search and Replace in XML
by Anonymous Monk on Sep 16, 2009 at 14:23 UTC |