#!/usr/bin/perl
use strict;
use warnings;
use XML::Twig;
my $out_file = 'C:\web_bu.xml';
# export the XML
open (my $fh_out, '>', $out_file) or die "unable to open '$out_file' for writing: $!";
my $t = XML::Twig->new(
twig_roots => {'display-name' => \&convert},
twig_print_outside_roots => $fh_out,
pretty_print => 'nice'
);
# including data for ease of post
#$t->parsefile( $file);
$t->parse(*DATA);
sub convert {
my ($t, $elt) = @_;
my $txt = $elt->text();
if ($txt =~ /wtw_reports/i) {
$elt->set_text('SOMEGUY');
} else {
$elt->set_text($txt);
}
}
__DATA__
wtw_reports-CIMS_MMA_20110429_DEV
Apache-Axis Servlet
AxisServlet
org.apache.axis.transport.http.AxisServlet
Axis Admin Servlet
AdminServlet
org.apache.axis.transport.http.AdminServlet
100
AxisServlet
/servlet/AxisServlet
AxisServlet
*.jws
AxisServlet
/services/*
AdminServlet
/servlet/AdminServlet
index.html
index.htm
index.jsp
default.html
default.htm
default.jsp
####
AxisServlet
org.apache.axis.transport.http.AxisServlet
AdminServlet
org.apache.axis.transport.http.AdminServlet
100
AxisServlet
/servlet/AxisServlet
AxisServlet
*.jws
AxisServlet
/services/*
AdminServlet
/servlet/AdminServlet
index.html
index.htm
index.jsp
default.html
default.htm
default.jsp