hi ,
i have created an XML file and needs to update the values of a particular attribute
i tried using xmlwriter class but it writes the whole file again
so please help me out.....if any one knows the solution for it
hi ,
i have created an XML file and needs to update the values of a particular attribute
i tried using xmlwriter class but it writes the whole file again
so please help me out.....if any one knows the solution for it
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
PallaviPosted Mar 6, 2008, 12:03 AM
it worked
Scott LyslePosted Feb 27, 2008, 10:43 PM
Here is a way you can do that:
string path = "c://Scott//Data//sample xml//books.xml"; XmlDocument doc = new XmlDocument(); doc.Load(path); XmlNodeList elems = doc.GetElementsByTagName("title"); for (int i = 0; i < elems.Count; i++) { if (elems[i].InnerXml == "Midnight Rain") { elems[i].InnerXml = "BK Broiler"; } } doc.Save("c://temp/new.xml");