antovinraj has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
Good Evening. I am using the xpath in my program and i an retrive and update the values. But I am unable to save the file. I have attached the code bellow.
use XML::XPath; $name = "Vinodh"; my $file = '../main/memlist.xml'; my $xp = XML::XPath->new(filename=>$file); my $nodeset = $xp->find("/MEMBERLIST/LIST[NICK='$name']/ROWID"); $data = $xp->getNodeText("/MEMBERLIST/LIST[NICK='$name']/NICKID"); print $data; $val = "9999"; $xp->setNodeText("/MEMBERLIST/LIST[NICK='$name']/NICKID",$val);
My Xml file is
<?xml version="1.0" encoding="Windows-1252"?> <MEMBERLIST> <LIST><NICK>0</NICK><ROWID>100</ROWID><NICKID>12545</NICKID><RANK>9</R +ANK></LIST> <LIST><NICK>007</NICK><ROWID>101</ROWID><NICKID>10125</NICKID><RANK>5< +/RANK></LIST> <LIST><NICK>Vinodh</NICK><ROWID>102</ROWID><NICKID>12498</NICKID><RANK +>18</RANK></LIST> <LIST><NICK>0P</NICK><ROWID>103</ROWID><NICKID>5472</NICKID><RANK>4</R +ANK></LIST> </MEMBERLIST>
U tell how to save the document in the file
Thanks & Advance Wishes
20060814 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to save a XML File using XPath
by derby (Abbot) on Aug 14, 2006 at 13:18 UTC | |
|
Re: How to save a XML File using XPath
by gellyfish (Monsignor) on Aug 14, 2006 at 13:13 UTC | |
|
Re: How to save a XML File using XPath
by Tanktalus (Canon) on Aug 14, 2006 at 15:23 UTC |