.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");