XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlPath);
var root = xmlDoc.DocumentElement;//取到根结点
XmlElement node = (XmlElement)xmlDoc.SelectSingleNode("BookStore/NewBook");
node.SetAttribute("Name", "WPF");
xmlDoc.Save(xmlPath);