当前位置:   article > 正文

Mybatis中配置xml时报Wrong root element: 5Attribute namespace is not allowed here: 5错误解决方法(idea)

attribute namespace is not allowed here

初学者容易犯的错误

MyBatis官网中复制

  1. <!DOCTYPE configuration
  2. PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-config.dtd">

后忘记修改

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE configuration
  3. PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-config.dtd">
  5. <mapper namespace="userMapper">
  6. <select id="findAll" resultType="com.itrs.domain.User">
  7. select * from user
  8. </select>
  9. </mapper>

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="userMapper">
  6. <select id="findAll" resultType="com.itrs.domain.User">
  7. select * from user
  8. </select>
  9. </mapper>

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
  

闽ICP备14008679号