XML新建节点

原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>

posted on 2006-01-26 00:47  samuel's blog  阅读(356)  评论(1)    收藏  举报

导航