原XML文件内容:
…
…
<BackupList>
<count1></count1>
</BackupList>
…
…
using System.Xml;
XmlDocument doc = new XmlDocument();
doc.Load(Application.StartupPath + "
\\XML\\backupSet.xml");
XmlElement root = doc.DocumentElement;
XmlNode dd = root.SelectSingleNode("BackupList");
XmlElement newEl = doc.CreateElement("count");
newEl.SetAttribute("value",xmlBackupTime);
newEl.SetAttribute("path",tbBackupDirectory.Text);
执行CODE后
<BackupList>
<count1></count1>
<count></count>
</BackupList>