`

eclispe 编辑XML时,输入<无法自动提示的修复

 
阅读更多

eclispe 当编辑XML时,一般情况下,输入<后,会自动提示关键字。有时候在无法在线联网时就不会自动提示。如何解决?以struts2的配置为例,在struts.xml的配置里,前面声明有:

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
 "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
 "http://struts.apache.org/dtds/struts-2.3.dtd">


实际上,eclipse提示是来自于http://struts.apache.org/dtds/struts-2.3.dtd 的定义文件,因此可以实现本地化。具体操作如下:

  1. 找到Struts2 的lib目录,将struts2-core-2.3.4.jar解压开,找到上述配置文件中的struts-2.3.dtd。
  2. 在eclipse 的 Perferences 中的MyEclipse->Files and Editors->XML->XML Catalog中,点击add,Key Type选择URI,Key输入http://struts.apache.org/dtds/struts-2.3.dtd ,Location 选择指向本地struts-2.3.dtd文件即可 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics