积极答复者
XML 解析错误:找不到根元素

问题
答案
-
xml格式错误,举个例子
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup></configuration> 应该是缺少这一行
专注于.NET ERP/CRM开发框架,C/S架构,SQL Server + ORM(LLBL Gen Pro) + Infragistics WinForms
- 已标记为答案 Lexan-Live 2018年4月21日 2:00
-
- 已标记为答案 Lexan-Live 2018年4月21日 2:00
全部回复
-
xml格式错误,举个例子
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup></configuration> 应该是缺少这一行
专注于.NET ERP/CRM开发框架,C/S架构,SQL Server + ORM(LLBL Gen Pro) + Infragistics WinForms
- 已标记为答案 Lexan-Live 2018年4月21日 2:00
-
你好,
首先你可以检查一下XML格式有没有问题。
如果XML格式没问题,我建议你贴一下相关的XML内容,以及你解析XML的相关代码。
- 已编辑 Zhi LvModerator 2017年8月8日 6:29
-
Lexan-Live:
你的XML文件是否有根?比如说以下的XML是合法的:
<Root> <Node1>……</Node1> <Node2> <Node3>……</Node3> </Node2> </Root>
以下则为不合法:
<Root> <Node1>……</Node1> <Node2> <Node3>……</Node3> </Node2> </Root> <Root> <Node1>……</Node1> <Node2> <Node3>……</Node3> </Node2> </Root>
理由:因为在.NET中解析的时候,没有顶层的XML元素会解析失败。
如果不是这个原因,请给出详细的XML数据便于分析。
谢谢您!
ASP.NET Forum
StackOverFlow
FreeRice Donate
Issues to report
-
Asp的项目xml解析失败,我只要思路,网上给的是js跨域。
你的XML样式什么样子的?另外你准备怎么解析?
ASP.NET Forum
StackOverFlow
FreeRice Donate
Issues to report
-
就是跳转到移动端就会这样PC端就不会,弄个重定向看看能不能解决,反正是asp项目又不是asp.net,我也很蒙圈
1)你的移动端是平板还是手机?是安卓还是苹果还是模拟器?最好给出具体型号。
2)你的提供XML的数据是WebApi还是WCF还是Windows Service?
3)移动端用真实的手机平板浏览器(我看你的截图貌似是PC上模拟器)有此类情况吗?
ASP.NET Forum
StackOverFlow
FreeRice Donate
Issues to report
-
- 已标记为答案 Lexan-Live 2018年4月21日 2:00