1. Problem description:
Sometimes we will encounter such a problem. When we want to write the xml file configuration (such as the hibernate configuration file in this article), there is no corresponding prompt after pressing the shortcut key Alt + /, as shown in the figure (there is a problem):
Of course, sometimes the following icon may appear (correct)
2. Solution:
Find the dtd file where you want to write the xml configuration (Document Type Definition is a set of grammatical rules for tags established for data exchange between programs, in short, it defines a set of writing rules), Here I want to write the xxx.hbm.xml file
After configuration, use the same method to configure the xml corresponding to hibernate.cfg.xml, which will not be repeated here.
Finally, reopen the xml configuration file you want to write, and press the prompt Alt+/, you can automatically prompt (Note: You will only get a prompt after adding a namespace, which can be found in the corresponding dtd file, here for convenience , paste the corresponding namespace)
/** xxx.hbm.xml 对应的命名空间 */
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
/** xxx.cfg.xml 对应的命名空间 */
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
3. Summary
When writing the xml configuration file in the future, see if you can download the corresponding dtd file from Baidu or find it locally. Most of the prompting problems can be solved by the above methods.