1、点击Preference搜索catalog
2、点击XML Catalog
3、点击Add
4、点击File System找到要导入的xsd文件,将Location末尾的名字复制到key末尾,key type选择Schema location
2、点击XML Catalog
3、点击Add
4、点击File System找到要导入的xsd文件,将Location末尾的名字复制到key末尾,key type选择Schema location
5、选择xml文件的Design编辑器
6、右键需要添加约束的元素,选择Edit namespace,点击Add
7、选择Specify New Namespace,点Browse,点击Select XML Catalog entry,选择之前导入的约束即可
8、将spring-beans.xsd之前的部分复制到第二行,beans复制到Prefix,实际使用中beans不用加Prefix,这里只是演示,其他约束需要。
9、约束导入完成
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">