java关于报错:The reference to entity "characterEncoding" must end with the ';' delimiter.

Java 解析XML文件错误。

错误信息提示代码类似如下:

The reference to entity "characterEncoding" must end with the ';' delimiter.
org.xml.sax.SAXParseException: The reference to entity "characterEncoding" must end with the ';' delimiter.

ontext initialization failed
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 9 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: The reference to entity "characterEncoding" must end with the ';' delimiter.

纠错结果:

在配置一个访问数据库的Url时,第一次设置的内容如下:

jdbc:mysql://localhost:3306/photo?useUnicode=true&characterEncoding=UTF-8,注意中间那个“&”,在xml中这个是读不出的,正确写法将“&”转义“&”:

jdbc:mysql://localhost:3306/photo?useUnicode=true&characterEncoding=UTF-8

分析:

有时候在使用xml作为配置文件的时候,应该要使用xml的编码规则来进行适当的设置。

下面给出xml中一些特殊符号的编码转换:

 < 小于号
> > 大于号
& & and字符
' ' 单引号
" " 双引号

---------------------
作者:杨四郎2018
来源:CSDN
原文:https://blog.csdn.net/yang5726685/article/details/56015938
版权声明:本文为博主原创文章,转载请附上博文链接!

java报错:The reference to entity "characterEncoding" must end with the ';' delimiter.的更多相关文章

  1. 在java的xml文件配置数据库URL地址时提示The reference to entity "characterEncoding" must end with the ';' delimiter.错误信息

    配置数据库的URL<property name="url" value="jdbc:mysql://127.0.0.1:3306/micro_message&quo ...

  2. The reference to entity "characterEncoding" must end with the ';' delimiter

    数据源配置时加上编码转换格式后出问题了: The reference to entity "characterEncoding" must end with the ';' del ...

  3. xml文件中配置JDBC源遇到问题 : The reference to entity "characterEncoding" must end with the ';' delimiter

    数据源配置时加上编码转换格式后出问题了: The reference to entity"characterEncoding" must end with the ';' deli ...

  4. The reference to entity "characterEncoding" must end with the ';' delimiter (Mybatis + Mysql)

    数据源配置时加上编码转换格式后出问题了: The reference to entity "characterEncoding" must end with the ';' del ...

  5. Caused by: org.xml.sax.SAXParseException: The reference to entity "characterEncoding" must end with the ';' delimiter.

    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Sourc ...

  6. 项目配置 xml文件时 报错提示(The reference to entity "useSSL" must end with the ';' delimiter.)

    这次在配置xml文件时,出现错误提示( The reference to entity “useSSL” must end with the ‘;’ delimiter.) 报错行为 <prop ...

  7. 配置c3p0-config.xml数据库连接池,jdbcurl配置项报错Type The reference to entity "useUnicode" must end with the ';' delimiter.

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xml> <c3p0-confi ...

  8. java 报错及解决

    java文件编译报错:error: unmappable character for encoding ASCII 解决: 编译时:javac -encoding utf-8 TestJava.jav ...

  9. [java报错]Could not instantiate listener XXXXXX

    写在开头的话: 兜兜转转,辞去了深圳的工作,回到了武汉,从事的居然一度是我最不想学的语言-java,曾经以为自己并不会java,但是上手之后,发现语言都是相通的,自己一度排斥学习java真的是不能再傻 ...

随机推荐

  1. asp.net SQLite关于各版本的调试

    最近想做一个简版的管理系统,将SQL SERVER数据库切换到SQLite数据库中,采用的是SQLite3的版本数据库. 开发工具:SV2015 UP3 数据库:SQLite3 项目整体结构图 相同的 ...

  2. 【C#进阶学习】泛型

    一.泛型引入 需求:传入一个类型(整型/日期/字符串或其他),打印出它的类型和内容. 1.初级版 public class CommonMethod { /// <summary> /// ...

  3. Linux之IO

    速度差异 I/O不仅仅是硬盘,还包括外围的所有设备,比如键盘鼠标,比如1.44M的3.5英寸软盘(还有人记得么).但服务器环境,泛指硬盘. 硬盘有多慢呢?我们不去探究不同设备的实现细节,直接看它的写入 ...

  4. 《EOPL》 : 实现了 call/cc

    待填坑 完整代码:scheme-code/EOPL/ch5/4-LETREC (CPS)-Exception-扩展/exer-5.43__★callcc/

  5. C# 中using 用来释放资源的用法

    using(...) {........} 定义了一个范围,等范围结束以后进行资源的释放. 例如: using(SqlConnection conn = new SqlConnection(" ...

  6. Stage3D大冒险

    摘自:http://dreamana.com/weblog/?p=92 摘自:http://baike.baidu.com/view/6794042.htm Stage3D的Flash Player和 ...

  7. angular6 页面加载数据时的loading提示

    使用npm安装ngx-loading模块 npm install --save ngx-loading 在app.module.ts中导入模块 import { BrowserModule } fro ...

  8. Nginx 反向代理功能-实现Nginx tcp负载均衡

    Nginx 反向代理功能-实现Nginx tcp负载均衡 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任.

  9. PCA 在手写数字数据集上的应用

    在 skilearn 的手写数据集中,每个数据点都是 0 到 9 之间手写数字的一张 8*8 灰度图像.用 PCA 将其降维到二维,并可视化数据点,如下: 1.digits 数据演示: from sk ...

  10. 让Discuz! X3.2 SEO标题里的“-”支持空格

    打开Discuz!根目录下source\class\helper\helper_seo.php文件找到如下代码: public static function strreplace_strip_spl ...