Following are some of the options to do the same
1. Using XmlDocument
XmlDocument doc = new XmlDocument();
doc.Load("D:\\build.xml");
XmlNode root = doc.DocumentElement;
XmlNode myNode = root.SelectSingleNode("galleries::folder");
myNode.Value = "blabla";
doc.Save("D:\\build.xml");
2. You can also use LINQ to do the same
using System.Xml.Linq;
XDocument xmlFile = XDocument.Load("D:\\build.xml");
var query = from c in xmlFile.Elements("galleries").Elements("folder")
select c; foreach (XElement folder in query)
{
folder.Attribute("attr1").Value = "MyNewValue";
}
xmlFile.Save("build.xml");