xml的节点默认是不允许修改的,本文也就不做处理了
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlPath);
XmlElement element = (XmlElement)xmlDoc.SelectSingleNode("BookStore/NewBook");
element.SetAttribute("Name", "Zhang");
xmlDoc.Save(xmlPath);
xml的节点默认是不允许修改的,本文也就不做处理了
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlPath);
XmlElement element = (XmlElement)xmlDoc.SelectSingleNode("BookStore/NewBook");
element.SetAttribute("Name", "Zhang");
xmlDoc.Save(xmlPath);
转载于:https://www.cnblogs.com/mmbbflyer/p/7715639.html