zoukankan      html  css  js  c++  java
  • java报错:The reference to entity "characterEncoding" must end with the ';' delimiter.

    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
    版权声明:本文为博主原创文章,转载请附上博文链接!

  • 相关阅读:
    mapreduce 本地调试需要注意的问题
    socket-----爬虫&&文件传输
    多个地点ping服务器
    linux grep命令详解
    关于真多核和加多核&线程由哪几部分组成
    内存溢出和内存泄漏
    指针和引用的区别
    Doxygen的使用,配置及实例
    【转】doxygen+graphviz生成工程中的类继承树及函数调用图
    转载--void指针(void *的用法)
  • 原文地址:https://www.cnblogs.com/ryelqy/p/10266595.html
Copyright © 2011-2022 走看看