Eclipse:xml文件中Schema的本地支持


由於在xml文件中使用xml節點的提示信息,一般采用引入URL的方式,例如

<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:tx="http://www.springframework.org/schema/tx"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
                http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
                http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">

這種方式只能夠在網絡連接時才能夠使用,在網絡不穩定的情況下,智能提示效果很差,因此,通過設置Eclipse對Schema進行本地支持,可以解決上述問題。

下面本文以http://www.springframework.org/schema/context/spring-context-3.1.xsd為例進行設置:

第一步:選中Windows-->Preferences

第二步:尋找到下拉列表XML-->xml Category,點擊xml Category,右部區域出現一個新的界面

第三步:選中User Specified Entries,點擊Add按鈕,彈出一個對話框

第四步:尋找到xsd文件並選中,一般xsd文件放置在D:\EngineerSoftware\java_tool\spring-framework-3.2.0.RC2-dist\spring-framework-3.2.0.RC2\Schema文件下。

第五步:修改Key type下拉選項中Namespace name 為Schema location

第六步:Key 編輯框中在路徑后加入對應Schema的文件名。例如導入Schema文件后的路徑是http://www.springframework.org/schema/aop,在該路徑后加入\spring-aop-3.2.xsd,點擊OK,就完成了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM