org.xml.sax.SAXParseException: The content of element type “sqlMapConfig” must match “(properties?,s
来源:互联网 发布:彩虹秒赞源码2017 编辑:程序博客网 时间:2024/05/09 02:09
最近在学习ibatis,但是在配置文件的地方出现了错误,老是提示org.xml.sax.SAXParseException: The content of element type “sqlMapConfig” must match “(properties?,settings?,resultObjectFactory?,ypeAlias*,typeHandler*,transactionManager?,sqlMap+)+”,
经过网上不断的搜索,终于找到了原因,原来ibatis配置文件的属性是有顺序的。
这个是我以前的代码:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<settings
cacheModelsEnabled="true"
enhancementEnabled="true"
lazyLoadingEnabled="true"
maxRequests="32"
maxSessions="10"
maxTransactions="5"
useStatementNamespaces="false"
/>
<properties resource="com/ibatis/utils/SqlMap.properties"/>
<transactionManager type="JDBC" commitRequired="false">
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="${driver}"/>
<property name="JDBC.ConnectionURL" value="${url}"/>
<property name="JDBC.Username" value="${username}"/>
<property name="JDBC.Password" value="${password}"/>
</dataSource>
</transactionManager>
<sqlMap resource="com/ibatis/utils/User.xml"/>
</sqlMapConfig>
注意红色部分的顺序。
然而正确的顺序应该是
properties?,settings?,resultObjectFactory?ypeAlias*,typeHandler*,transactionManager?,sqlMap
所以改成如下的顺序就OK了:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<properties resource="com/ibatis/utils/SqlMap.properties"/>
<settings
cacheModelsEnabled="true"
enhancementEnabled="true"
lazyLoadingEnabled="true"
maxRequests="32"
maxSessions="10"
maxTransactions="5"
useStatementNamespaces="false"
/>
<transactionManager type="JDBC" commitRequired="false">
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="${driver}"/>
<property name="JDBC.ConnectionURL" value="${url}"/>
<property name="JDBC.Username" value="${username}"/>
<property name="JDBC.Password" value="${password}"/>
</dataSource>
</transactionManager>
<sqlMap resource="com/ibatis/utils/User.xml"/>
</sqlMapConfig>
问题解原文地址:http://blog.csdn.net/moliai/article/details/5605185
- org.xml.sax.SAXParseException: The content of element type “sqlMapConfig” must match “(properties?,s
- org.xml.sax.SAXParseException: The content of element type “sqlMapConfig” must match “(properties?,s
- org.xml.sax.SAXParseException The content of element type "package" must match "(result-types?,inter
- "org.xml.sax.SAXParseException: The content of element type "class" must match" 异常解决
- org.xml.sax.SAXParseException: The content of element type "configuration" must match
- The content of element type "sqlMapConfig" is incomplete, it must match "(properties?,settings?,resu
- mybatis-config.xml:报SAXParseException: The content of element type "configuration" must match
- Error parsing XML. org.xml.sax.SAXParseException: Element type "sqlMapConfig" must be declared出错解决方法
- SAXParseException: The content of element type “sqlMapConfig” 解决方案
- xml解析org.xml.sax.SAXParseException: The element type "comment" must
- org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or
- Cause: org.xml.sax.SAXParseException: The content of elements must consist of well-formed character
- Caused by: org.xml.sax.SAXParseException: The content of elements must consist of well-formed charac
- The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHand
- The content of element type "struts" must match "((package|include|bean|constant)*,unknown-handler-s
- ibatis:The content of element type "sqlMap" must match
- The content of element type "package" must match...
- The content of element type "struts-config" must match 解决方案
- 天津哪个治疗精神病医院比较好
- Coursera Scala 4-1:函数作为对象
- 天津哪个治疗精神病医院最好
- 定位 UNIX及LINUX 上常见问题的经验总结
- 天津哪个中医院治精神病
- org.xml.sax.SAXParseException: The content of element type “sqlMapConfig” must match “(properties?,s
- 异步Ext.TreePanel获取后台数据时的注意事项
- How Android handles KEY_POWER?
- jsp 自定义标签
- Coursera Scala 4-3:子类型和泛型
- 天津哪家医院能治疗精神病
- MPMoviePlayerController的用法和播放时只有声音没有图像的解决办法
- Coursera Scala 4-6:模型匹配
- 天津哪个专家治疗精神病好