On Nov 21, 2013, at 7:16 PM, Jeremy Boynes <jboy...@apache.org> wrote:

> On Nov 21, 2013, at 4:59 AM, ma...@apache.org wrote:
> 
>> Author: markt
>> Date: Thu Nov 21 12:59:36 2013
>> New Revision: 1544165
>> 
>> URL: http://svn.apache.org/r1544165
>> Log:
>> Extend the reach of the Context attribute xmlValidation to cover XML parsing 
>> by Jasper the JSP engine.
>> Fix a TODO and enable validation (if required) for implicit TLD files.
> 
> JSP 6.2.4 raises issues around attempting to validate JSP Documents (.jspx 
> and .tagx) due to the mixin's from the jsp: namespace. This could perhaps be 
> enabled using a separate option from validation of the descriptors so users 
> can validate the standard files but not need to add anything to the 
> DOCTYPE/XSD for the application content.

This may not be that simple, and I think I've some other issues in this area, 
see http://svn.apache.org/r1545537

The test there fails because the schema cannot be found. JspDocumentParser is 
not setting the baseURI for the document being parser and its implementation of 
URI resolver always returns null. This means it cannot resolve the systemId 
"valid.xsd" relative to the document, tries using the current working 
directory, does not find it there and hence fails because it cannot find the 
schema to validate against.

If I replace the relative URI with a absolute location then it attempts to 
validate but fails because the <jsp:text> element is not valid in the "string" 
simple type of root.

If I do not enable validation in JspDocumentParser, the .jspx evaluates 
correctly and the client is able to parse and validate the XML document 
response (showing the XSD and XSI are valid).

If I disable XSD validation but leave DTD validation on then it fails because 
there is no DOCTYPE in the .jspx

It seems to me the original behaviour from JSP6.2.4 is the best we can do:
* parse with no validation
* if a DOCTYPE is found, restart with DTD validation on
* never attempt XSD validation

This would eliminate the need for the "org.apache.jasper.XML_VALIDATE_DOC" 
option and related context property so I propose we back that change out.

I'd been meaning to update JspDP to be a DefaultHandler2 to match the XML 
refactoring in Digester so I'll fix the baseURI issue as part of that.

Cheers
Jeremy

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to