错误:XML 文档结构必须在同一实体内开始和结束 [英] Error: XML document structures must start and end within the same entity

查看:23
本文介绍了错误:XML 文档结构必须在同一实体内开始和结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 XML 的新手并收到以下错误:

I am new to XML and getting the below error:

错误:XML 文档结构必须在相同的范围内开始和结束实体

Error: XML document structures must start and end within the same entity

输入 XML:

<?xml version="1.0" encoding="ISO-8859-1"?>
<root>
<test>
<access1>113AL</access1>
<access2>119AL</access2>
</test>
<test>
<access2>115AL<s/access2>
<access3>116AL</access3>
</test>
<test>
<access4>118AL</access4>
<access5>119AL</access5>
</test>
<copies>
<test2>
<access>113AL</access>
<Copy>Y</Copy>
</test2>
<test2>
<access>113AX</access>
<Copy>N</Copy>
</test2>
</copies>
</root>

推荐答案

您的 XML 格式不正确.通常,此错误表明开始和结束标记的范围有问题.

Your XML is not well-formed. In general, this error indicates that something is wrong with the range of the start and end tags.

特别是在您的情况下,您在 access2 结束标记之一中有一个杂散的 s:

In particular in your case, you have a stray s in one of the closing access2 tags:

    <access2>115AL<s/access2>

这是您已解决问题的 XML;它现在格式良好(并缩进以提高可读性):

Here is your XML with the problem resolved; it is now well-formed (and indented to improve readability):

<?xml version="1.0" encoding="ISO-8859-1"?>
<root>
  <test>
    <access1>113AL</access1>
    <access2>119AL</access2>
  </test>
  <test>
    <access2>115AL</access2>
    <access3>116AL</access3>
  </test>
  <test>
    <access4>118AL</access4>
    <access5>119AL</access5>
  </test>
  <copies>
    <test2>
      <access>113AL</access>
      <Copy>Y</Copy>
    </test2>
    <test2>
      <access>113AX</access>
      <Copy>N</Copy>
    </test2>
  </copies>
</root>

这篇关于错误:XML 文档结构必须在同一实体内开始和结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆