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
In reply to How to save a XML File using XPath by antovinraj
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |