创见一个test.XML文件,内容如下:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
  </appSettings>
</configuration>
请问怎么实现。xml接触的比较少,代码最好详细点

解决方案 »

  1.   

    XmlDocument doc = new XmlDocument();
    XmlNode head = doc.CreateXmlDeclaration("1.0", "utf-8", "");
    doc.AppendChild(head);
    XmlNode node = doc.CreateElement("configuration");
          
    doc.AppendChild(node);
    XmlNode nodeappSettings = doc.CreateElement("appSettings");
    nodeappSettings.InnerText = "";
    node.AppendChild(nodeappSettings);
    doc.AppendChild(node);
    doc.Save("i:\\x.xml");