8,906
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="utf-8"?>
<bookstore>
<book genre="fantasy" ISBN="2-3631-4" old="29">
<title>Oberon's Legacy</title>
<author>Corets, Eva</author>
<price>5.95</price>
</book>
<applenote genre="fantasy" ISBN="2-3631-4">
<title>Oberon's Legacy</title>
<author>Corets, Eva</author>
<price>5.95</price>
</applenote>
<book genre="fantasy" ISBN="2-3631-6">
<title>Oberon's Legacy</title>
<author>Corets, Eva</author>
<price>5.96</price>
</book>
<book genre="fantasy" ISBN="2-3631-6">
<title>Oberon's Legacy</title>
<author>Corets, Eva</author>
<price>5.97</price>
</book>
</bookstore>
XmlElement xe1 = xmlDoc.CreateElement(childNodeName);//创建一个节点
parentNode.AppendChild(xe1);//添加到父节点节点中
for (int i = 0; i < tmpXe.Count; i++)
{
xe1.AppendChild(tmpXe.Item(i));//将临时节点添加到新元素中
xmlDoc.Save(xmlFile);
}