62,269
社区成员
发帖
与我相关
我的任务
分享<students>
<item name="" code="2566" cometime="2008-12-3 15:30:25" />
<item name="" code="2098" cometime="2008-12-9 15:37:25" />
<Item name="greatverve" code="2100" cometime="2008-12-9 15:37:25" />
</students> protected void Button1_Click(object sender, EventArgs e)
{
//string xmlfile=MapPath(@"db/
XmlDocument doc = new XmlDocument();
doc.Load(@"F:\db\XMLFile.xml");
XmlNode node = doc.CreateElement("Item");
XmlAttribute xmlattr = doc.CreateAttribute("name");
xmlattr.Value = XmlConvert.DecodeName("greatverve");
node.Attributes.Append(xmlattr);
xmlattr = doc.CreateAttribute("code");
xmlattr.Value = XmlConvert.DecodeName("2100");
node.Attributes.Append(xmlattr);
xmlattr = doc.CreateAttribute("cometime");
xmlattr.Value = XmlConvert.DecodeName("2008-12-9 15:37:25");
node.Attributes.Append(xmlattr);
doc.ChildNodes[0].AppendChild(node);
doc.Save(@"F:\db\XMLFile.xml");
}