XML   parsing   error   on   file   /WEB-INF/web.xml:   (line   4,   col   -1) web.xml 第四行error 

解决方案 »

  1.   

    <?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">
      <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>
    </web-app>-----------这是web.xml的内容,请问怎么改呢?
      

  2.   

    <web-app 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"
        version="2.4">照这个覆盖相应部分吧!
      

  3.   

    原因分析:是由于xml parser: Crimson不能解释带有类似于xmlns:xsi这样的属性.要用Xerces才行,解决办法是通过在程序中设定jre的xml parser为Xerces,同时将Xerces的jar包加入到classpath中,一共有三个包:xalan.jar,xercesImpl.jar,xml-apis.jar从http://xml.apache.org/xalan-j/上可以下载.http://xerces.apache.org/xerces-j/
    jre的xml parser设置:是jrelib下的一个叫jaxp.properties文件,最后有三行是关于指定 xml parser的,将注释去掉,或者在程序中加入以下语句也可以:
    System.setProperty("javax.xml.parsers.DocumentBuilderFactory","org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
    System.setProperty("javax.xml.parsers.SAXParserFactory","org.apache.xerces.jaxp.SAXParserFactoryImpl");
      

  4.   

    郁闷啊,我安装的是jdk1.5,它的jre1.5里面lib下怎么找都找不到jaxp.properties文件,请高手指点啊!
      

  5.   

    jaxp.properties只有ibm的jdk里才有,sun的没有。
    不用一棵树上吊死吧?上面不是还有一种方法可以解决的吗?