2 wulongbin439009082 wulongbin439009082 于 2014.07.08 21:54 提问

mybatis解析标签错误SAXParseException,提示namespace必须声明,麻烦大家给看一下

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">


<![CDATA[
select count(user_id) from sys_user where user_name = '#userName'
]]>

<resultMap type="tprivilegeUser" id="tprivilegeUser">
    <id column="USER_ID" property="userId"></id>
    <result column="USER_NAME" property="userName"></result>
    <result column="USER_SEX" property="sex"></result>
    <result column="USER_PWD" property="password"></result>
    <result column="USER_ADDRES" property="addres"></result>
    <result column="USER_EMAIL" property="email"></result>
    <result column="USER_QQ" property="qq"></result>
    <result column="USER_MOBILE_PHONE" property="mobilePhone"></result>
    <result column="ONLINE" property="online"></result>
    <result column="VALID" property="valid"></result>
</resultMap>

<select id="getTprivilegeUser" parameterType="String" resultType="tprivilegeUser" resultMap="tprivilegeUser">
    <![CDATA[ 
        select * from T_TPRIVILEGE_USER where USER_NAME = '#identify' or USER_EMAIL='#identify' or USER_MOBILE_PHONE = '#identify'
    ]]>
</select>

在加载的时候提示Caused by: org.xml.sax.SAXParseException: Attribute "namespace" must be declared for element type "mapper".
我在开头已经定义过了,不知道为什么还报这个错
麻烦帮忙看一下,感激不尽

3个回答

qwuack
qwuack   2014.07.08 22:21

要用标签把其他内容包括进来

qq_36128330
qq_36128330   2017.08.10 20:52

配置文件的名称换一下就可以了

qq_36128330
qq_36128330   2017.08.10 21:01

是mapper的接口和配置文件名称不能一样

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!