c# - Overwrite a xml file value -


i have xml file this

<count>0</count> 

now wish overwrite value 0. how do in c#?

edit

<counter>   <count>0</count>   <email>   </email> </counter>` 

this xml file wish write value in email element , change value of count element

            xmldocument doc = new xmldocument();             doc.load(counter);             foreach (xmlnode node in doc.selectnodes("count"))             {                 node.innertext = (count-1).tostring();             }             foreach (xmlnode node in doc.selectnodes("email"))             {                 node.innertext = (count - 1).tostring();             }             doc.save(counter); ` 

when no values written file

your direct problem use of doc.selectnodes("count") instead of doc.getelementsbytagname("count")


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -