繁体   English   中英

org.xml 解析 XML.sax.SAXParseException 时出现异常:元素的内容必须由格式正确的字符数据或标记组成

[英]org.xmlGetting exception while parsing XML.sax.SAXParseException: The content of elements must consist of well-formed character data or markup

我在由 WSDL 文件形成的处理程序中发送一个查询,如果我们无权访问数据库,它只是执行查询。 处理程序只有一个 xml 标记,我们必须在其中编写要执行的查询,然后它将查询数据库并以 xml 格式返回响应。 我正在执行一个简单的选择查询以获取一行的详细信息。 但在回应中,我收到以下异常

org.xml.sax.SAXParseException:The content of elements must consist of well-formed character data or markup.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)

proper return response XML should be
<row>    
 <Vendor>
      <Number>
         <CountryCode>1</CountryCode>
         <AreaCode>23</AreaCode>
         <SubNumber>456</SubNumber>
      </Number>
 </Vendor>
</row>

in this <SubNumber> tag is giving error,
i am not aware of value inside this tag in database.


i followed the stack trace and piece of code which is throwing the exception is:
   DOMParser parser = new DOMParser();    

任何人都可以帮我解决这个例外吗? 去哪里找? 需要修改吗? 我需要检查返回数据中的标签吗? 那些基本上有效的 Child1 标签的设计方式是,它在其中包含一个 XML,该 XML 将持续到表的一列中

您的 XML无效

row-->Parent-->Child-->Child 1

XML 元素名称中不能有空格。 您的 xml 元素名称Child 1有一个空格。

XML 元素名称必须遵循这些命名规则......

  • 名称可以包含字母、数字和其他字符
  • 名称不能以数字或标点符号开头
  • 名称不能以字母 xml(或 XML、或 Xml 等)开头
  • 名称不能包含空格

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM