Author: kkolinko Date: Tue Jan 7 22:10:02 2014 New Revision: 1556377 URL: http://svn.apache.org/r1556377 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55973 Fix processing of XML schemas when validation is enabled in Jasper.
The code is based on a similar fragment in Digester#getFactory(). Modified: tomcat/tc7.0.x/trunk/java/org/apache/jasper/xmlparser/ParserUtils.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc7.0.x/trunk/java/org/apache/jasper/xmlparser/ParserUtils.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/xmlparser/ParserUtils.java?rev=1556377&r1=1556376&r2=1556377&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/jasper/xmlparser/ParserUtils.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/xmlparser/ParserUtils.java Tue Jan 7 22:10:02 2014 @@ -98,6 +98,16 @@ public class ParserUtils { DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); factory.setValidating(validating); + if (validating) { + // Enable DTD validation + factory.setFeature( + "http://xml.org/sax/features/validation", + true); + // Enable schema validation + factory.setFeature( + "http://apache.org/xml/features/validation/schema", + true); + } DocumentBuilder builder = factory.newDocumentBuilder(); builder.setEntityResolver(entityResolverInstance); XmlErrorHandler handler = new XmlErrorHandler(); Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1556377&r1=1556376&r2=1556377&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Jan 7 22:10:02 2014 @@ -70,6 +70,10 @@ Correct a regression in the XML refactoring that meant that errors in TLD files were swallowed. (markt) </fix> + <fix> + <bug>55973</bug>: Fix processing of XML schemas when validation is + enabled in Jasper. (kkolinko) + </fix> </changelog> </subsection> <subsection name="Web applications"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org