eclipse中XML文档没有提示

以spring下面配置文件为例:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:util="http://www.springframework.org/schema/util"
	xsi:schemaLocation="http://www.springframework.org/schema/beans  
	http://www.springframework.org/schema/beans/spring-beans-4.0.xsd >

<beans>

如果在编辑以下XML配置文件时,eclipse按alt + / 没有提示。那么需要如下配置:

1. window -> Preferences -> 搜索XML Catalog。

2. 点击add...

3. 输入如下(注意:xsd文件与XML配置文件中对应):

    location: F:\soft\spring-framework-2.5.6\dist\resources\spring-beans-2.5.xsd(xsd文件在本地的位置)

  Key Type: Schema location

  Key: http://www.springframework.org/schema/beans/spring-beans-4.0.xsd

4. OK -> OK

这样就可以了。

猜你喜欢

转载自ysj5125094.iteye.com/blog/2054081