in reply to Re^2: Missing values in XML::Twig Output
in thread Missing values in XML::Twig Output
use strict; use warnings; use XML::Twig; my $out_file = 'C:\web_bu.xml'; my $t = XML::Twig->new( twig_handlers => {'display-name' => \&convert}, pretty_print => 'indented' ); $t->parse(*DATA); open (my $fh_out, '>', $out_file) or die "unable to open '$out_file' f +or writing: $!"; $t->print($fh_out); # this prints to the filehandle sub convert { my ($t, $elt) = @_; my $txt = $elt->text(); if ($txt =~ /wtw_reports/i) { $elt->set_text('SOMEGUY'); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Missing values in XML::Twig Output
by TJRandall (Sexton) on May 03, 2011 at 15:26 UTC | |
by toolic (Bishop) on May 03, 2011 at 15:42 UTC | |
by TJRandall (Sexton) on May 03, 2011 at 15:56 UTC |