写Xml文件的问题 只要我使用了XmlDocumnet我的DataSet写xml文件全部报错郁闷!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 错误截图在:http://jinesc.6600.org/bbs/update/20034/27204161.gif 仔细看一下路径,你确认有那个路径么?如果有那个路径,你的程序是否有权限(假如你用ASP.NET的话)? C#当然有,因为我不用XDocument写C文件时用DataSet读取A B文件都是正常当我用了XmlDocumnent后DataSet.WriteXml就会出现上述图中的错误 can you show your 用DataSet读取A B文件 code ? 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时这些都是工作得好好的 AB文件和C文件读写间没有任何关联的 刚刚测试了一下 // 测试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");居然没问题这个郁闷啊 // 测试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");下一行就是函数结束的}位置 这样不出错 // 测试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"); I cannot reproduce your problem you didn't mention they are in different directory and cannot tell from your sample code eitherds.ReadXml("folder.xml");...xDoc.Save("test.xml"); 哪些程序是WPF开发的? c#去除字符串中的换行符,并用split分割时不计算在length内 ModBus返回HTTP/1.1 400 C# 悬浮菜单 C#计算器程序解释寻求 Jmail中加了附件后,收不到邮件正文?!! 大家能不能推荐几个漂亮的界面和实现方法? 我登录CSDN时以下信息提示越来越频繁,大家那儿的情况如何? 急:"找不到文件或程序集名称“Interop.ADODB”,或找不到它的一个依赖项。"是怎么一回事 关于网页浏览的问题,在线等待 怎么没有人回答小弟的问题呀:( 在.NET c# WINFORM中怎样写连接当前目录下的ACCESS数据库?
如你用ASP.NET的话)?
DataSet.WriteXml就会出现上述图中的错误
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时这些都是工作得好好的
// 测试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");居然没问题这个郁闷啊
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");下一行
就是函数结束的}位置
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");
...
xDoc.Save("test.xml");