use strict; use warnings; use XML::Twig; my $x = <<EOF; <?xml version="1.0" encoding="UTF-8" standalone="no" ?> <Profile xmlns="xxxxxxxxx" name="" version="1.1" xmlns:xsi="http:// www.w3.org/2001/XMLSchema-instance"> <Application Name="App1" Id="/Local/App/App1" Services="1" pol +icy="" StartApp="" Bal="5" sessInt="500" WaterMark="1.0"/> <AppProfileGuid>586e3456dt</AppProfileGuid> </Profile> EOF my $t = XML::Twig->new(twig_handlers => {Application => \&app}); $t->parse($x); $t->print(); sub app { my ($twig, $app) = @_; my $id = $app->att('Id'); $id =~ s{^/Local/App}{}; $app->set_att('Id', $id); }
In reply to Re: XML::Twig Text replacement
by toolic
in thread XML::Twig Text replacement
by Gizmo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |