今天在mybatis的mapper映射配置文件中遇到了这样的问题,困扰了我3个小时:
Multiple annotations found at this line:
- The content of element type "mapper" must match "EMPTY".
- Attribute "namespace" must be declared for element type
"mapper".
代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<mapper namespace="com.ckx.entity.User">
</mapper>
第四行mapper标签一直报错!找不到问题原因,也百度尝试了百家学说,终无成就。无奈改了下表头格式如下:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ckx.entity.User">
</mapper>
*万岁!问题解决了!可为什么有什么不一样吗?
这个放原因在于头部的医用错误 :
http://mybatis.org/dtd/mybatis-3-mapper.dtd