浏览 5527 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2007-06-07
web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID" 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-app> 要在网上读取验证文件 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 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |