myeclipse 10 添加xml文件所使用的dtd


1,打开MyEclipse,找到菜单栏“Window”---->“Preferences(首选项)”;

2,在左侧导航菜单栏找到“MyEclipse”---->“Files and Editors”---->“XML”--->“XML Catalog”;

3,在右边的界面中,选择“User Specified Entries”,点击右边的“Add...”;

4,在弹出的“Add  XML Catalog Element”的对话框中点击“File System...”,为Location输入框添加DTD文件所在路径,也可以点击“Workspace”,为Location输入框添加DTD文件所在路径;

5,使用文本编辑器打开此DTD文件,找到相应的<!DOCTYPE ...>文档类型声明,

比如说Hibernate的配置文件:hibernate.cfg.xml所需要的DTD文件为:

hibernate-configuration-3.0.dtd

    打开hibernate-configuration-3.0.dtd后,找到如下内容:

<!DOCTYPE hibernate-configuration PUBLIC

"-//Hibernate/Hibernate Configuration DTD 3.0//EN"

"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

6,“Key Type:”右边的下拉框中(有三个类型:Public ID,System ID,URI),

根据hibernate-configuration-3.0.dtd中的<!DOCTYPE...>中的PUBLIC,

选择Public ID(或者直接选择“URI”也可);

7,“Key:”右边的文本框中,将hibernate-configuration-3.0.dtd中的<!DOCTYPE...>

中的PUBLIC后的双引号内的内容复制,然后粘贴到“Key:”右边的文本框中,

注意,COPY的内容不带双引号"";

8,点击“OK”,即可看到“User Specified Entries”已有了所增加的DTD(的KEY);

同样,hibernate-mapping-3.0.dtd这个DTD的加入,也可以如法炮制;

9,重启MyEclipse即可,注意如果提示不出来,

 并在状态栏的左下出现“Content Assist not available at the current location”,

请在光标位置键入一个空格再使用Alt+/试试;



猜你喜欢

转载自blog.csdn.net/Amos_liu/article/details/50808961