jfarcand 2003/09/25 12:27:59 Modified: catalina/src/share/org/apache/catalina/startup ContextConfig.java TldConfig.java Log: Follow a 101 Tranning course on how to use Xerces 2.3/2.5 and fix the schema validation problem. The fix will only works for Xerces when schema are supported (Crimson will still work). Changes between 2.1/2.3 seems to have modified the way the parser is working. Those private property will be added to the next release of jaxp. Thanks to ramesh mandava at sun for is teaching lesson :-) Revision Changes Path 1.36 +23 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextConfig.java Index: ContextConfig.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- ContextConfig.java 23 Sep 2003 21:37:00 -0000 1.35 +++ ContextConfig.java 25 Sep 2003 19:27:59 -0000 1.36 @@ -300,7 +300,7 @@ if (context instanceof StandardContext) { ((StandardContext) context).setReplaceWelcomeFiles(true); } - webDigester.setUseContextClassLoader(true); + webDigester.setUseContextClassLoader(false); webDigester.push(context); webDigester.parse(is); } else { @@ -497,12 +497,31 @@ webDigester = patchXerces(webDigester); } - url = ContextConfig.class.getResource(Constants.WebSchemaResourcePath_24); + url = ContextConfig.class. + getResource(Constants.WebSchemaResourcePath_24); + SchemaResolver webEntityResolver = new SchemaResolver(url.toString(), webDigester); if (validation) { - webDigester.setSchema(url.toString()); + if (webDigester.getFactory().getClass() + .getName().indexOf("xerces")!=-1) { + try{ + webDigester.setFeature( + "http://apache.org/xml/features/validation/dynamic", + true); + webDigester.setFeature( + "http://apache.org/xml/features/validation/schema", + true); + } catch(ParserConfigurationException e){ + // log("contextConfig.registerLocalSchema", e); + } catch(SAXNotRecognizedException e){ + // log("contextConfig.registerLocalSchema", e); + } catch(SAXNotSupportedException e){ + // log("contextConfig.registerLocalSchema", e); + } + + } } url = ContextConfig.class.getResource(Constants.WebDtdResourcePath_22); 1.29 +18 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/TldConfig.java Index: TldConfig.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/TldConfig.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- TldConfig.java 23 Sep 2003 21:37:00 -0000 1.28 +++ TldConfig.java 25 Sep 2003 19:27:59 -0000 1.29 @@ -409,7 +409,24 @@ tldDigester); if (xmlValidation) { - tldDigester.setSchema(url.toString()); + if (tldDigester.getFactory().getClass() + .getName().indexOf("xerces")!=-1) { + try{ + tldDigester.setFeature( + "http://apache.org/xml/features/validation/dynamic", + true); + tldDigester.setFeature( + "http://apache.org/xml/features/validation/schema", + true); + } catch(ParserConfigurationException e){ + // log("contextConfig.registerLocalSchema", e); + } catch(SAXNotRecognizedException e){ + // log("contextConfig.registerLocalSchema", e); + } catch(SAXNotSupportedException e){ + // log("contextConfig.registerLocalSchema", e); + } + + } } url = TldConfig.class.getResource(Constants.TldDtdResourcePath_11);
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]