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
Post a Comment