码迷,mamicode.com
首页 > 其他好文 > 详细

Cause: org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.

时间:2017-08-15 17:14:57      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:rac   cep   exception   java   语句   session   转义   str   nsis   

Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
    at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:238)
    at org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:107)
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.<init>(XMLMapperBuilder.java:59)
    at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:383)
    ... 78 more
Caused by: org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1414)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.startOfMarkup(XMLDocumentFragmentScannerImpl.java:2606)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2704)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:235)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
    at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:236)
    ... 81 more

 

错误的原因是mybatis配置文件中,sql语句包含了>,>=, < ,<= 等这样的符号,这样的符号mybatis的配置文件识别不了,需要加上

 

<![CDATA[

    sql语句

]]>

或者用xml转义字符:
  &lt;    <     小于号    <= 和&lt;=的表示是一个意思
  &gt;    >     大于号

 &amp;    &     和

&apos;    ’     单引号

&quot;    "     双引号

Cause: org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.

标签:rac   cep   exception   java   语句   session   转义   str   nsis   

原文地址:http://www.cnblogs.com/wangchunlan1299/p/7365882.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!