用eclipse,在導入相應的包后(有人說不導包也有提示,因為默認的eclipse導入了jdk的包),eclipse會有代碼提示功能。
那么XML文件能不能也這樣呢?其實也是可以的,只不過導包的地方不一樣。下面以spring為例(雖然Myeclipse6.5中已經(jīng)集成了,這里只是示范說明)。
進入:window -> Preference... -> MyEclipse -> Editors -> XML ->XML Catalog
選擇:選中“User Specified Entries”,點擊“Add...”按鈕
填入:
URI: 請選擇本地文件系統(tǒng)上SPRING_HOME\dist\resources\spring-beans-2.0.xsd 文件
Key Type: 選擇Schema Location
Key: http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
點擊確定
將spring配置文件關閉再重新打開即可。可以使用MyEclipse XML Editor打開這些xml文件。