在hibernate或spring等很多配置文件中,编写代码时不能够自动提示,很多时候都是由于没有引入dtd文件,下面介绍在配置文件中引入dtd文件的步骤:
以hibernate.cfg.xml/*hbm.xml为例:
1)在\hibernate-distribution-3.3.1.GA\project\core\src\main\resources\org\hibernate目录下面找到
hibernate-configuration-3.0.dtd 文件
2)Myeclipse开发环境下:
window->preferences->Myeclipse->Files and Editors->xml->xml catalog->user Specified Entried 导入文件
location:dtd文件的绝对路径
key Type:URI (选择URI)
key:对应:
hibernate.cfg.xml文件中的dtd地址:(红色字体部分)
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
设置完成后,先关闭对应文件然后再打开,就可以正常提示了.