XML文件中转义字符和<![CDATA[]]>的简单使用-例(mybatis)
在XML中,需要转义的字符有:
(1)& &
(2)< <
(3)> >
(4)" "
(5)' '
在XML中,不使用转义字符,可使用标签<![CDATA[]]>:
打个例子-在mybatis配置mapper中的xml文件:
使用转义字符:
<select id="getTypeByPrice" resultType="Car">
select * from web_app_shop where price > 100000
</select>
标签<![CDATA[]]>:
<select id="getTypeByPrice" resultType="Car">
<![CDATA[
select * from web_app_shop where price > 100000
]]>
</select>