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月前
|
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...]
(standard input): No keywords in input file
(standard input): No keywords in input file
85 0
|
编解码 搜索推荐 算法
Data-Data Objects and Attribute Types| 学习笔记
快速学习 Data-Data Objects and Attribute Types。
129 0
Data-Data Objects and Attribute Types| 学习笔记
|
XML 数据格式
Do not concatenate text displayed with setText,use resource string with placeholders.
Do not concatenate text displayed with setText,use resource string with placeholders.
213 0
Do not concatenate text displayed with setText,use resource string with placeholders.
the title and note has maintained the same text type
the title and note has maintained the same text type
81 0
the title and note has maintained the same text type
|
XML 数据格式
SAP Fiori Elements - how to set breakpoint to get converted xml view parsed by f
SAP Fiori Elements - how to set breakpoint to get converted xml view parsed by f
194 0
SAP Fiori Elements - how to set breakpoint to get converted xml view parsed by f
|
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".
152 0
Open quote is expected for attribute "{1}" associated with an element type "id".
the code place where the binding is converted to final value displayed in u
the code place where the binding is converted to final value displayed in u
102 0
the code place where the binding is converted to final value displayed in u
Cannot find source code based button in SE24 - modification assistant
Cannot find source code based button in SE24 - modification assistant
123 0
OPA 15 - find existing item by its type.note
Created by Wang, Jerry, last modified on Nov 08, 2015
124 0
OPA 15 - find existing item by its type.note