The MyBatis Generator plug-in encounters a solution to the database password containing special symbols such as &

  In the SpringBoot project, when using the generator plug-in to generate code, I found an error:

[ERROR] XML Parser Error on line 16: References to the entity "T" must end with the';' separator.

  The generator.xml database jdbcConnection configuration in the project is as follows:

13		<jdbcConnection driverClass="com.mysql.jdbc.Driver"
14                      connectionURL="jdbc:mysql://localhost:3306/testonldb"
15                      userId="root"
16                      password="test&T">
17      </jdbcConnection>

  See another blog for the complete generator.xml configuration file: https://blog.csdn.net/piaoranyuji/article/details/104063149

  Analysis of the cause of the error:
  In the xml file, the "&" symbol exists as an entity, and here needs to be changed to the entity character of the "&" symbol.
  In HTML reserved characters must be replaced with character entities (character entities). For example, in HTML, to display the less than sign, we must write: < (entity name) or < (entity number).

  Solution:
  Just replace the special symbol "&" in the generator.xml configuration file with its entity name "&".
  The modified configuration file is as follows:

13		<jdbcConnection driverClass="com.mysql.jdbc.Driver"
14                      connectionURL="jdbc:mysql://localhost:3306/testonldb"
15                      userId="root"
16                      password="test&amp;T">
17      </jdbcConnection>

  Tip: The
  advantage of using entity names instead of entity numbers is that the names are easy to remember. However, the disadvantage is that browsers or other plug-ins may not support all entity names, but support for entity numbers is very good.
  Entity names are case sensitive!
  Common character entity reference: https://www.w3school.com.cn/html/html_entities.asp .
  Complete character entity reference: https://www.w3school.com.cn/tags/html_ref_entities.html .

Guess you like

Origin blog.csdn.net/piaoranyuji/article/details/107706806