解决web-app

xiaoxiao2022-06-23  35

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 ">   要在网上读取验证文件 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
转载请注明原文地址: https://www.6miu.com/read-4954958.html

最新回复(0)