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