元素包含的 SaxParseException 内容必须匹配 EMPTY

SaxParseException content of element include must match EMPTY

正在执行 Mybatis 3.2.8 我正在使用元素 "property" 作为元素 "include" 的内容,如文档中所述:

http://mybatis.org/mybatis-3/es/sqlmap-xml.html

<select id="selectUsers" resultType="map">
  select
    <include refid="userColumns"><property name="alias" value="t1"/></include>,
    <include refid="userColumns"><property name="alias" value="t2"/></include>
  from some_table t1
    cross join some_table t2
</select>

当我尝试执行上面的代码时出现错误:元素包含的 SaxParseException 内容必须匹配 EMPTY

我下载了 DTD 是正确的:

<!-- Dynamic -->

<!ELEMENT include (property+)?>
<!ATTLIST include
refid CDATA #REQUIRED
>

那么,为什么我会收到异常?

好的,在深入了解 MyBatis 的源代码后,我得到了解释:

版本 3.2.8 中的 DTD:

<!-- Dynamic -->

<!ELEMENT include EMPTY>
<!ATTLIST include
refid CDATA #REQUIRED
>

版本 3.3.0 上的 DTD(目前由 http://mybatis.org/dtd/mybatis-3-mapper.dtd 指向):

<!-- Dynamic -->

<!ELEMENT include (property+)?>
<!ATTLIST include
refid CDATA #REQUIRED
>

所以只需从 3.2.8 版升级到 3.3.0 版,一切都会恢复正常