SAXParseException An invalid XML character 问题的解决


paip.SAXParseException An invalid XML character.txt

Caused by: org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0xdd65) was found in the comment.

现象大概如下

 

Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0xdd65) was found in the comment.
at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:212)
at org.apache.ibatis.parsing.XPathParser.(XPathParser.java:81)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.(XMLMapperBuilder.java:43)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:243)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:66)
... 53 more
Caused by: org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0xdd65) was found in the comment.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1438)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanComment(XMLScanner.java:764)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanComment(XMLDocumentFragmentScannerImpl.java:771)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1730)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:250)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:210)

 

-----原因
JDK的XML解析兼容性不好。有些XML文件格式不太正规。。
在节点中加了注释。造成的这种问题。


----定位出错的XML

下载MYBATIS的源码,附加上去调试。定位了出错的XML文件。。
然后把此文件一半XML代码删除,再试,直到这样二分查找试出出错的节点。。

 

我的原因是这样的

 

	<select id="dao-t_wl_logistics_d.queryforChild"
        parameterType="hashmap" resultType="flexmap">
        select logistics_scheme_no ,<!-- 物流方案号 -->
        node_no ,<!-- 节点号 -->
        logistics_act_code ,<!-- 活动类型代码 -->
        logistics_act_name,<!-- 活动类型名称 -->
        trnp_mode_code_21 ,
        trnp_mode_name_21,
        base_place_code,
        base_place_name ,
        delivery_place_code ,
        delivery_place_name

</select>

posted @ 2011-03-03 14:06  attilaxAti  阅读(11)  评论(0编辑  收藏  举报