The content of elements must consist of well-formed character data or markup解决方法

简介:

首先来看看xml的命名规则

 
  1. XML 元素必须遵循以下命名规则: 
  2.  
  3. 名称可以含字母、数字以及其他的字符 
  4. 名称不能以数字或者标点符号开始  
  5. 名称不能以字符 “xml”(或者 XML、Xml)开始  
  6. 名称不能包含空格  

 

 
  1. The content of elements must consist of well-formed character data or markup. 

在解析XML的时候遇到了这个问题,原因很简单XML开始标记只能以字符开始,而不能以数字或者空格开始,如果遇到这个问题,快去看看你所解析的XML是否有以下形式的内容,从xml元素的命名规则中可以看到,以下例子是错误的

 
  1. <3009>123</3009> 
  2. <  pa>55</pa > 

如果存在以上形式的内容,肯定会出现文中最开始所提到的错误的。



本文转自sucre03 51CTO博客,原文链接:http://blog.51cto.com/sucre/917109,如需转载请自行联系原作者

相关文章
|
3月前
|
CDN
Iconfont——Error: <path> attribute d: Expected number, "MNaNNaNaNaNNaNNaN…".
Iconfont——Error: <path> attribute d: Expected number, "MNaNNaNaNaNNaNNaN…".
37 0
|
5月前
|
XML 数据格式
Xml declaration should precede all document content
Xml declaration should precede all document content
|
6月前
|
JSON Java 数据格式
Could not extract response: no suitable HttpMessageConverter found for ..content type [text/html...]
Could not extract response: no suitable HttpMessageConverter found for ..content type [text/html...]
681 0
|
JSON 数据格式
Content type ‘multipart/form-data;boundary=------57031299820747271;charset=UTF-8‘ not supported的解决方案
Content type ‘multipart/form-data;boundary=------57031299820747271;charset=UTF-8‘ not supported的解决方案
298 0
|
Java 微服务
Malformed markup: Attribute “prop“ appears more than once in element
Malformed markup: Attribute “prop“ appears more than once in element
279 0
(standard input): No keywords in input file
(standard input): No keywords in input file
119 0
解决办法:Type safety: The expression of type List needs unchecked conversion to conform
解决办法:Type safety: The expression of type List needs unchecked conversion to conform
322 0
[Accessibility] Missing contentDescription attribute on image
[Accessibility] Missing contentDescription attribute on image
181 0
[Accessibility] Missing contentDescription attribute on image
|
XML Java 数据库连接
Open quote is expected for attribute "{1}" associated with an element type "id".
Open quote is expected for attribute "{1}" associated with an element type "id".
201 0
Open quote is expected for attribute "{1}" associated with an element type "id".