I can't tell what GetXMLValue does, but generally using a module such as XML::Twig is the smart way to handle XML parsing and manipulation problems. Consider:
#!/usr/bin/perl use strict; use warnings; use XML::Twig; my $t = XML::Twig->new( twig_roots => {'CLIENT_INFO/FIELD' => \&convert}, twig_print_outside_roots => 1 ); $t->parse(*DATA); sub convert { my ($t, $elt) = @_; my $txt = $elt->text(); $elt->set_text('FINANCIAL SYSTEMS') if $txt =~ /FINANCE GROUP/i; $elt->print (); } __DATA__ <CLIENT_INFO> <LOCATION> New York </LOCATION> <FIELD> FINANCE GROUP </ +FIELD> <NO_OF_WORKERS> 123 </NO_OF_WORKERS> </CLIENT_INFO>
Prints:
<CLIENT_INFO> <LOCATION> New York </LOCATION> <FIELD>FINANCIAL SYSTEMS +</FIELD> <NO_OF_WORKERS> 123 </NO_OF_WORKERS> </CLIENT_INFO>
In reply to Re: Changing XML Tag value in Perl Script
by GrandFather
in thread Changing XML Tag value in Perl Script
by Rajpreet1985
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |