org.xml.sax.SAXParseException: The content of element type “sqlMapConfig” must match “(properties?,s
来源:互联网 发布:关闭miui优化会流畅么 编辑:程序博客网 时间:2024/05/02 15:27
最近在学习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 解决方案
- php 大数据量及海量数据处理算法总结
- oracle建完库后,我们必须先设好的三个参数
- javascript中的异常处理
- Android进程间通信--消息机制及IPC机制实现
- jqplot js图表绘制工具
- org.xml.sax.SAXParseException: The content of element type “sqlMapConfig” must match “(properties?,s
- 定位错误的一些方法
- DropDownList(下拉列表框)绑定数据的方式
- Design Pattern On Road
- hibernate-cascade属性介绍
- STM32内置参照电压的使用(转)
- 面向对象编程五大原则
- CCD会成为下一个恐龙吗
- QQ联系