添加一个 这种类型的节点 System.Xml.XmlDeclaration

解决方案 »

  1.   

    System.Xml.XmlDocument doc =new System.Xml.XmlDocument();
    System.Xml.XmlDeclaration de = doc.CreateXmlDeclaration(...);
      

  2.   

    不明白孟子大哥的话
    我这样写是可以运行的。System.Xml.XmlDocument doc = new XmlDocument();
    System.Xml.XmlDeclaration d = doc.CreateXmlDeclaration("1.0","gb2312","yes");
    doc.AppendChild(d);
    doc.AppendChild(doc.CreateElement("doc"));
    doc.Save("c:\\1.xml");