XML里对&转义

在XML文件中配置数据库的连接,复制

<property name="connection.url">jdbc:mysql://localhost:3306/test?serverTimezone=UTC&characterEncoding=utf-8</property>

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

原来是XML中需要将   “&”转义“&amp;”

上述代码改

<property name="connection.url">jdbc:mysql://localhost:3306/test?serverTimezone=UTC&amp;characterEncoding=utf-8</property>

错误消失!


版权声明:本文为qq_42938220原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。