C#编辑xml文件

string path = @"C:\Users\Administrator\Desktop\无人智能便利店\install\收银端\XMLRFI.xml";
XmlDocument xmlDoc = new XmlDocument();//新建XML文件
xmlDoc.Load(path);//加载XML文件
XmlNode xm = xmlDoc.SelectSingleNode("RFI");
XmlElement xelKey = xmlDoc.CreateElement("RFIID");
XmlAttribute xelType = xmlDoc.CreateAttribute("Type");
xelType.InnerText = "data";
xelKey.SetAttributeNode(xelType);
XmlElement xelAuthor = xmlDoc.CreateElement("author");
xelKey.InnerText = "dfdsa";
xm.AppendChild(xelKey);
xmlDoc.Save(path);

C#编辑xml文件

上一篇:集装箱学习(两):动手模拟AOP


下一篇:Windows Form 中快捷键设置