mapper文件中寫sql語句時提示Tag name expected,找到原因是因為xml不識別<號需要用特定轉義符來表示<號。
<select id="selectHavingOrtherResultNotYetProcessed" resultMap="BaseResultMap" > select <include refid="Base_Column_List" /> from mark_result where length(ai_json) < 180 and ai_json not like '{"gmtModified%' AND ai_json not like '{}' and code is null </select>
在 XML 中,一些字符擁有特殊的意義。
如果您把字符 "<" 放在 XML 元素中,會發生錯誤,這是因為解析器會把它當作新元素的開始。
這樣會產生 XML 錯誤:
為了避免這個錯誤,用實體引用來代替 "<" 字符,如下:
<message>if salary <1000 then</message> 需要改為<message>if salary < 1000 then</message>
在 XML 中,有 5 個預定義的實體引用:
注意:在 XML 中,只有字符 "<" 和 "&" 確實是非法的。大於號是合法的,但是用實體引用來代替它是一個好習慣。