.net修改XML数据解决思路
.net修改XML数据XML code?xml version1.0 encodingutf-8?RulesNode 转换率1 //Rules前台
.net修改XML数据
XML code<?xml version="1.0" encoding="utf-8"?><Rules> <Node 转换率="1" /></Rules>
前台有个txtConversion和btnOK按钮,怎么修改啊
[解决办法]XElement root = XElement.Load("Data.xml");
root.Element("Node ").ReplaceAttributes("转换率", "要替换的值");
[解决办法][解决办法]C# code XmlDocument xmldoc = new XmlDocument(); xmldoc.Load("***.xml"); XmlNode root = xmldoc.SelectSingleNode("Rules"); ((XmlElement)root.SelectSingleNode("Node")).SetAttribute("转换率", "1"); xmldoc.Save("***.xml");