xml文件报错 :The content of elements must consist of well-formed character data or markup.
2018-04-01 12:09
676 查看
使用mytis查询数据的时候,要首先写一个对应的mapper.xml文件,结果文件出现了错误:
找到最后才知道是因为
XML中常用的转义字符如下:
另一种方法是使用特殊标记,例如:
表示不适用xml的语法进行解析。
除此之外,XML文件的一些语法规则也要注意一下:例如元素的名称不可以用数字、标点开始,不能使用xml作为开头等等,最容易出错的地方是空格,例如;
找到最后才知道是因为
>=和
<=的问题,主要是尖括号的问题,找了一下解决方法,主要是两种,第一种是使用转义字符,将 > , < 替换掉,类似这样:
select * from tab where cola <= 5;
XML中常用的转义字符如下:
另一种方法是使用特殊标记,例如:
select * from tab where cola <![CDATA[ >= ]]> 5; //这是 >= ,<= 是<![CDATA[ <= ]]>
表示不适用xml的语法进行解析。
除此之外,XML文件的一些语法规则也要注意一下:例如元素的名称不可以用数字、标点开始,不能使用xml作为开头等等,最容易出错的地方是空格,例如;
<select >aaa<select>名曾与尖括号之间有空格是错误的写法。
相关文章推荐
- Mybatis xml报错: The content of elements must consist of well-formed character data or markup
- The content of elements must consist of well-formed character data or markup 或 The value of attribu
- Mybatis 异常: The content of elements must consist of well-formed character data or markup
- mybatis异常:The content of elements must consist of well-formed character data or markup.
- Mybatis 异常: The content of elements must consist of well-formed character data or markup
- The content of elements must consist of well-formed character data or markup.
- The content of elements must consist of well-formed character data or markup
- ibatiS启动的异常 The content of elements must consist of well-formed character data or markup
- The content of elements must consist of well-formed character data or markup
- 【iBATIS】The content of elements must consist of well-formed character data or markup
- mybatis 提示The content of elements must consist of well-formed character data or markup
- The content of elements must consist of well-formed character data or markup
- The content of elements must consist of well-formed character data or markup
- The content of elements must consist of well-formed character data or markup
- ibatis遇到错误:The content of elements must consist of well-formed character data or markup
- The content of elements must consist of well-formed character data or markup解决方法
- ibatiS启动的异常 The content of elements must consist of well-formed character data or markup
- Mybatis 异常: The content of elements must consist of well-formed character data or markup
- mybatis:The content of elements must consist of well-formed character data or markup
- 在XML中写SQL语句时出错,The content of elements must consist of well-formed character data or markup.