小编Ste*_*ton的帖子

System.XML.XmlException:''是一个意外的令牌.预期的标记是';'

我有一个HTML表单,我试图使用XDocument.Load加载,我收到以下错误:

' ' is an unexpected token. The expected token is ';'. Line 1257, position 66.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
Run Code Online (Sandbox Code Playgroud)

代码只是调用以下内容:

XDocument xmlDoc = XDocument.Load(pageData.Stream);
Run Code Online (Sandbox Code Playgroud)

pageData是来自另一个系统的自定义对象,即吐出数据流.我已经将xml导出回一个字符串,看起来很好.

当我在HTML上检查该行时,它只是元素的结束标记.xml异常给出的行/位置有多可靠?我只是将表单的来源转储到notepad ++中进行验证,我看不出它会成为一个问题.

编辑:以下是错误前后的前几行.我已经标记了错误行.

                                        </p>
                        </td>
                    </tr>
                </table>

            </td>
        </tr>  <----Error Line
        <tr>
            <td>
                <div id="BusinessJustificationForm">
                    <table id="BusinessJustificationTable">
                        <tr>
                            <td class="seperator" colspan="7">
Run Code Online (Sandbox Code Playgroud)

c# xml exception linq-to-xml

7
推荐指数
3
解决办法
5万
查看次数

标签 统计

c# ×1

exception ×1

linq-to-xml ×1

xml ×1