DB Story

[ Mybatis ] the content of elements must consist of well-formed character data or markup

WhiteDuck 2016. 9. 8. 12:47

the content of elements must consist of well-formed character data or markup 에러 발생시(톰캣, 스프링)



부등호 (즉 < , > ) 를 기냥 쓰게 되면 오류가 난다. (태그에 존재하는 <tag> 꺽쇠랑 동일하기 때문에 파싱에러발생)
이때는 <![CDATA[      ]]> 로 감싸주면 된다

 <select id="select" resultClass="DischargePointData" parameterClass="Map">
   SELECT
   seq   as seq
    , note   as note
   FROM
     table 
   user_id = #userId#
   <isNotEmpty prepend="AND" property="startYYYYMM" removeFirstPrepend="true">
<![CDATA[
        reg_date >= str_to_date(concat('#startYYYYMM#','01000000'),'%Y%m%d%H%i%s')
]]>
   </isNotEmpty>

 </select>



참고 : http://tost.tistory.com/144

반응형