【iBATIS】The content of elements must consist of well-formed character data or markup
2017-01-15 22:01
393 查看
报错提示:The content of elements must consist of well-formed character data or markup
因为语句中有一个小于号“<”,在XML中,会被当成一个页面元素来解析,不会处理为mysql的SQL语句的组成部分,修改如下:
1、在xml的sql语句中,不能直接用大于号、小于号要用转义字符
如果用小于号会报错误如下:
org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
解决办法:
1,转义字符
例如: state <= 3 则改成 state <= 3
2、使用<![CDATA[]]>标记
注意:<![CDATA[ ]]>标记的sql语句中的<where> <if>等标签不会被解析
<![CDATA[
state <= 3
]]>
这样,将会把SQL语句中与XML页面元素相同的元素屏蔽,是的XML不将其解析为XML的元素,从而生成正确的SQL语句。
因为语句中有一个小于号“<”,在XML中,会被当成一个页面元素来解析,不会处理为mysql的SQL语句的组成部分,修改如下:
1、在xml的sql语句中,不能直接用大于号、小于号要用转义字符
如果用小于号会报错误如下:
org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
解决办法:
1,转义字符
< | < | 小于号 |
> | > | 大于号 |
& | & | 和 |
' | ’ | 单引号 |
" | " | 双引号 |
2、使用<![CDATA[]]>标记
注意:<![CDATA[ ]]>标记的sql语句中的<where> <if>等标签不会被解析
<![CDATA[
state <= 3
]]>
这样,将会把SQL语句中与XML页面元素相同的元素屏蔽,是的XML不将其解析为XML的元素,从而生成正确的SQL语句。
相关文章推荐
- ibatiS启动的异常 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
- 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
- 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 mark
- 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.
- JSF遭遇XML解析错误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.
- Mybatis xml报错: 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
- 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
- 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