mapper文件中写sql语句时提示Tag name expected,找到原因是因为xml不识别<号需要用特定转义符来表示<号。
<select id="findSearch" resultType="com.test.demo.entity.Foursshop">
SELECT foursID,foursname,linkman,duty,phone,address FROM foursshop
<where>
lasttesttime < #{lasttesttime}
</where>
</select>
记录问题:
解决方案:
在 XML 中,一些字符拥有特殊的意义。如果您把字符 “<” 放在 XML 元素中,会发生错误,这是因为解析器会把它当作新元素的开始。
转义之前 | 转义之后 |
---|---|
< | < |
> | > |
’ | ' |
‘’ | " |