Replacing the innertext of an Xml node/element Replacing the innertext of an Xml node/element xml xml

Replacing the innertext of an Xml node/element


Using XmlDocument and XPath you can do this

XmlDocument doc = new XmlDocument();doc.Load(reader); //Assuming reader is your XmlReaderdoc.SelectSingleNode("buttons/workshop1").InnerText = "new text";

You can use doc.Save to save the file also.

Read more about XmlDocument on MSDN.

EDIT

To save the document do this

doc.Save(@"C:\myXmFile.xml"); //This will save the changes to the file.

Hope this helps you.