解决web-app_2_4.xsd验证web.xml时报j2ee_web_services_clie

2008-06-17 16:24:26
查看( 47 ) / 评论( 0 )
解决web-app_2_4.xsd验证web.xml时报j2ee_web_services_client_1_1.xsd找不到的问题
web.xml
代码
<?xml version="1.0" encoding="UTF-8"?>
< web-app version =" 2.4 " xmlns =" http://java.sun.com/xml/ns/j2ee "
xmlns:xsi =" http://www.w3.org/2001/XMLSchema-instance "
xsi:schemaLocation =" http://java.sun.com/xml/ns/j2ee
 
要在网上读取验证文件 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd来验证web.xml文件格式的正确性,导致速度变慢。
该验证在修改xml文件后,每次保存文件时都要进行执行的。
 
一、XMLSpy中的解决办法
1、 下载以下所有的验证文件到本地,比如放:<XMLSpy_HOME>\Schemas\java目录下
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
http://java.sun.com/xml/ns/j2ee/jsp_2_0.xsd
http://java.sun.com/xml/ns/j2ee/j2ee_1_4.xsd
http://java.sun.com/xml/ns/j2ee/j2ee_web_services_client_1_1.xsd
注意: j2ee_1_4.xsd 中却包含了 Web services schema ,即如下:
代码
< xsd:include schemaLocation =" http://www.ibm.com/webservices/xsd/j2ee_web_services_client_1_1.xsd "/> 
但是要下载却下载不了,于是上Sun Java去。。。
http://java.sun.com/xml/ns/j2ee/中有,显示的仍是ibm的,但链接是sun的,可以直接下载下来的
于是索性在 j2ee_1_4.xsd 就更改掉它:)
代码
            <!-- <xsd:include schemaLocation="http://www.ibm.com/webservices/xsd/j2ee_web_services_client_1_1.xsd"/> -->
            < xsd:include schemaLocation =" j2ee_web_services_client_1_1.xsd "/>
2、在 <XMLSpy_HOME>\MainCatalog.xml 文件中增加如下内容并保存
代码
            <!-- web-app 2.4 Section -->
            < uri name =" http://java.sun.com/xml/ns/j2ee " uri =" schemas/java/web-app_2_4.xsd "/>
3、重启XMLSpy,打开web.xml,然后按F8吧,绿色的打色出现了吧。
二、Eclipse中的解决办法
1、同上下载所有的验证文件到本地。。。
2、Windows ==> Preferences ==> Web and XML ==> XML Catalog,然后右边窗口点击 add 按钮,打开 Add XML Catalog Entry 窗口。URI选择框选择到 web-app_2.4.xsd 文件 ,确定后,Key Type 会自动选中 Namespace Name ,Key会自动填入: http://java.sun.com/xml/ns/j2ee ,OK 确定即可。
3、重新打开web.xml
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值