Hi, When using Tomcat with the last xerces version (2.7.1), there is a problem on jsp validation. (Note that next Tomcat version will have also 2.7.1 version (as it was put in the changelog) in current CVS tree). One way to fix it is in the org/apache/jasper/compiler/JspDocumentParser.java file. By replacing : factory.setFeature( "http://xml.org/sax/features/validation", validating); by : factory.setValidating(validating); (Patch at the end) Note that the setValidating() method is also used by digester which is used by Tomcat as other places. See getFactory() method. http://cvs.apache.org/viewcvs.cgi/jakarta-commons/digester/src/java/org/apache/commons/digester/Digester.java?view=markup I provide a sample (you could extract the xml snippet if you want to test it in Tomcat directly without the sample Class). I tried this example with Sun JDK 1.4.2_08, JDK 5_update4 and with xerces 2.6.2 and 2.7.1 (with endorsed java -Djava.endorsed.dirs=...) and with factory.setValidating(validating); it works in all cases. (like in Digester). It will be fine if it could be fixed in CVS for next Tomcat version. Regards, Florent Index: JspDocumentParser.java =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java,v retrieving revision 1.84 diff -u -r1.84 JspDocumentParser.java --- JspDocumentParser.java 30 Mar 2005 20:27:22 -0000 1.84 +++ JspDocumentParser.java 10 Aug 2005 15:22:04 -0000 @@ -1370,9 +1370,10 @@ factory.setFeature( "http://xml.org/sax/features/namespace-prefixes", true); - factory.setFeature( - "http://xml.org/sax/features/validation", - validating); + factory.setValidating(validating); // Configure the parser SAXParser saxParser = factory.newSAXParser(); // Configure the parser SAXParser saxParser = factory.newSAXParser();
Created attachment 15995 [details] Example reproducing the problem Class reproducing the jasper problem with xerces 2.7.1 java -Djava.endorsed.dirs=<path with xerces2.7.1 jars inside> sax.Sax
Created attachment 15996 [details] Patch for fixing this issue Patch for fixing this issue (with xerces 2.7.1), also it works with other xerces version and JDK
Wouldn't it be better to set both ?
It works for me only with one thing. Also, only xml with DTD have to be validated in this case of JSP (no schema). (Section JSP 6.2.4) So I think the use of only factory.setValidating(validating); will be OK. Regards, Florent
It's actually section 6.2.4. I think the change is reasonable, but I'll leave the old code in commented out.