Here's one way with XML::LibXML:
use warnings; use strict; use XML::LibXML; my $doc = XML::LibXML->load_xml(location => 'foo.xml'); my @nodes = $doc->findnodes('//param[@name="SSLKeyStorePassword"]'); if (@nodes) { warn "found more than one SSLKeyStorePassword" if @nodes>1; $nodes[0]->{value} = 'BLABLA8'; } else { die "did not find SSLKeyStorePassword" } $doc->toFile('bar.xml', 1);
Whatever you do, do not use regular expresions.
In reply to Re: XML replace password with a specific tag
by haukex
in thread XML replace password with a specific tag
by Bluesaka75
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |