只要我使用了XmlDocumnet我的DataSet写xml文件全部报错郁闷!!!!

解决方案 »

  1.   

    错误截图在:http://jinesc.6600.org/bbs/update/20034/27204161.gif
      

  2.   

    仔细看一下路径,你确认有那个路径么?如果有那个路径,你的程序是否有权限(假
    如你用ASP.NET的话)?
      

  3.   

    C#当然有,因为我不用XDocument写C文件时用DataSet读取A B文件都是正常当我用了XmlDocumnent后
    DataSet.WriteXml就会出现上述图中的错误
      

  4.   

    can you show your 用DataSet读取A B文件 code ?
      

  5.   

    OK
    if (this.m_DataSet == null)
    this.m_DataSet = new DataSet(); try
    {
    // 读取文件
    this.m_DataSet.ReadXml(this.m_FilePath);
    写:this.m_DataSet.WriteXml(this.m_FilePath);
    没有用XmlDocument时这些都是工作得好好的
      

  6.   

    AB文件和C文件读写间没有任何关联的
      

  7.   

    刚刚测试了一下
    // 测试DataSet和XmlDocument是否有冲突
    DataSet ds= new DataSet();
    ds.ReadXml("folder.xml");
    XmlDocument xDoc = new XmlDocument();
    xDoc.Load("file.xml");
    xDoc.Save("file.xml");
    ds.WriteXml("folder.xml");居然没问题这个郁闷啊
      

  8.   

    // 测试DataSet和XmlDocument是否有冲突
    DataSet ds= new DataSet();
    ds.ReadXml("folder.xml");
    ds.WriteXml("folder.xml",XmlWriteMode.WriteSchema);
    // XmlDocument xDoc = new XmlDocument();
    // xDoc.Load("file.xml");
    XmlDocument xDoc = new XmlDocument();
    XmlNode xNode; xDoc = new XmlDocument();

    // 添加声明
    xNode = xDoc.CreateNode(XmlNodeType.XmlDeclaration,"","");
    xDoc.AppendChild(xNode);
    xDoc.Save("test.xml");
    这样出错出错信息:系统错误出错位置,居然是xDoc.Save("test.xml");下一行
    就是函数结束的}位置
      

  9.   

    这样不出错 // 测试DataSet和XmlDocument是否有冲突
    DataSet ds= new DataSet();
    ds.ReadXml("folder.xml");
    ds.WriteXml("folder.xml",XmlWriteMode.WriteSchema);
    // XmlDocument xDoc = new XmlDocument();
    // xDoc.Load("file.xml");
    XmlDocument xDoc = new XmlDocument();
    XmlNode xNode;
    xDoc = new XmlDocument();
    xNode = xDoc.CreateNode(XmlNodeType.XmlDeclaration,"","");
    xDoc.AppendChild(xNode);
    xNode = xDoc.CreateElement("test");
    xDoc.AppendChild(xNode); xDoc.Save("test.xml");
      

  10.   

    I cannot reproduce your problem
      

  11.   

    you didn't mention they are in different directory and cannot tell from your sample code eitherds.ReadXml("folder.xml");
    ...
    xDoc.Save("test.xml");