1. 创建XML文档:
private void button1_Click(object sender, EventArgs e)
{
try
{
//创建XmlDocument对象
XmlDocument xmlDocument = new XmlDocument();
//创建Xml版本信息
XmlDeclaration xmlDeclaration = xmlDocument.CreateXmlDeclaration("1.0","GBK",null);
//向XmlDocument对象添加版本信息
xmlDocument.AppendChild(xmlDeclaration);
//创建根节点
XmlElement xmlElementRoot = xmlDocument.CreateElement("root");
xmlElementRoot.SetAttribute("isRoot", "True");
xmlDocument.AppendChild(xmlElementRoot);
//创建子节点1
XmlElement xmlElement1 = xmlDocument.CreateElement("xmlElement1");
xmlElement1.SetAttribute("isRoot","False");
xmlElementRoot.AppendChild(xmlElement1);
//创建子节点2
XmlElement xmlElement2 = xmlDocument.CreateElement("xmlElement2");
xmlE