Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Edit a node value in xml

by ramrod (Curate)
on Jul 23, 2009 at 15:59 UTC ( #782706=note: print w/replies, xml ) Need Help??

in reply to Edit a node value in xml

Using XML::LibXML
use XML::LibXML; my $template = 'sample.xml'; my $parser = XML::LibXML->new(); my $doc = $parser->parse_file($template); my($object) = $doc->findnodes("/project/run_count/count/text()"); my $text = XML::LibXML::Text->new('14'); $object->replaceNode($text); open (my $Output, ">$template") or die "Could not write $template"; print $Output $doc->toString; close ($Output) or die "Could not close generated $template ";

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://782706]
shmem serves tea along with the cookies. (☕) x @CBMonks
[shmem]: hmm.. which makes emerge the question: is there a way to attach a subroutine to a variable, which is run as soon as that variable changes?
[moritz]: through a tie?
[shmem]: moritz: of course!
shmem slaps forehead m(

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2017-04-24 12:21 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (439 votes). Check out past polls.