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,如需转载请自行联系原作者

相关文章
|
7天前
|
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...]
113 0
|
7月前
|
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的解决方案
67 0
|
8月前
|
JavaScript 前端开发 API
什么是 custom elements
什么是 custom elements
44 0
|
10月前
|
前端开发
CSS安装出错:Unicode Character Check -> Your temp directory path contains Unicode characters........
CSS安装出错:Unicode Character Check -> Your temp directory path contains Unicode characters........
253 0
|
11月前
|
Java 微服务
Malformed markup: Attribute “prop“ appears more than once in element
Malformed markup: Attribute “prop“ appears more than once in element
172 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
202 0
the title and note has maintained the same text type
the title and note has maintained the same text type
83 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
197 0
SAP Fiori Elements - how to set breakpoint to get converted xml view parsed by f
|
JavaScript 前端开发
sendData to ABAP backend via multiple form content type
Created by Jerry Wang, last modified on Aug 20, 2014
sendData to ABAP backend via multiple form content type
SAP Fiori Elements - fixed value help data request and how drop down list entry is rendered
SAP Fiori Elements - fixed value help data request and how drop down list entry is rendered
104 0
SAP Fiori Elements - fixed value help data request and how drop down list entry is rendered