根级别的数据无效。第 1 行,位置 1 - 为什么在加载 xml 文件时会出现此错误?
根级别的数据无效。第 1 行,位置 1 - 为什么在加载 xml 文件时出现此错误,
这是我的代码:
XmlDocument xmlDoc=new XmlDocument();
xmlDoc.LoadXml("file.xml");
Data at the root level is invalid. Line 1, position 1 -why I get this error while load xml file
this my code:
XmlDocument xmlDoc=new XmlDocument();
xmlDoc.LoadXml("file.xml");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
LoadXml
方法用于加载直接 XML 字符串。您想改用Load
方法。The
LoadXml
method is for loading an XML string directly. You want to use theLoad
method instead.