当前位置:Gxlcms > 数据库问题 > MyBatis Sql语句中的转义字符

MyBatis Sql语句中的转义字符

时间:2021-07-01 10:21:17 帮助过:41人阅读

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.

转义字符

 

                     <                                 

                     <

                     小于号                                           

                     &gt;

                     >                                      

                     大于号

                     &amp;

                     &

                     和

                     &apos;

                     ’

                     单引号

                     &quot;

                     "

                     双引号

2、使用
<![CDATA[ ]]>标记的sql语句中的<where> <if>等标签不会被解析

 

MyBatis Sql语句中的转义字符

标签:mybatis   body   大于   val   builder   不能   ali   cin   bsp   

人气教程排行