xml文件报错:The reference to entity "characterEncoding" must end with the ';' delimiter.

在xml文件中的mysql链接URL报错:The reference to entity "characterEncoding" must end with the ';' delimiter.

 

原因是在XML文件中,& 符号需要转义

<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
        connectionURL="jdbc:mysql://localhost:3306/ssm_crud??serverTimezone=UTC&characterEncoding=utf8&useUnicode=true&useSSL=false"
        userId="root"
        password="root">
</jdbcConnection>

正确写法是

connectionURL="jdbc:mysql://localhost:3306/ssm_crud??serverTimezone=UTC&amp;characterEncoding=utf8&amp;useUnicode=true&amp;useSSL=false"

在xml文件中有以下几类字符要进行转义替换:

&lt;

<

小于号

&gt;

>

大于号

&amp;

&

&apos;

'

单引号

&quot;

"

双引号

posted @ 2021-08-04 23:03  帅气型男  阅读(276)  评论(0编辑  收藏  举报