내 시간을 잡아먹는 에러
[에러] The content of elements must consist of well-formed character data ormarkup.
cg0826
2022. 4. 18. 23:41
반응형
sql.xml
<select id="Dao랑 매핑시킬 ID" parameterType="파라미터 type" resultType="반환할 결과 type">
SELECT CONCAT(T1.컬림A, ' > ', T1.컬럼B) FROM 테이블 T1
</select>
위와 같이 xml 파일에 쿼리문을 작성 할 떄, 다음과 같은 오류가 발생하게 됩니다.
Multiple annotations found at this line:
- The content of elements must consist of well-formed character data or markup.
- Start tag of element <select>
해당 오류가 발생하는 이유는 XML 에서 부등호를 문자열이 아닌 <select> </select>와 같이 시작과 끝을 알리는 TAG로 인식하기 때문입니다.
해결 방법
<select id="Dao랑 매핑시킬 ID" parameterType="파라미터 type" resultType="반환할 결과 type">
<![CDATA[
SELECT CONCAT(T1.컬림A, ' > ', T1.컬럼B) FROM 테이블 T1
]]>
</select>
부등호를 사용 할 쿼리문에 <![CDATA[ ]]> 를 사용해주면 오류가 발생하지 않습니다.
반응형