Bug #3228
closedXML validation problem no longer reported
0%
Description
I attached some sample documents. Transforming using Saxon EE the XML with the XSLT used to issue this error on the error listener with Saxon 9.6:
XTTE1515: The content \"xxx1-56592-235-2\" of element <ISBN> does not match the required simple type. Value \"xxx1-56592-235-2\" contravenes the pattern facet "\"\\d{1}-\\d{5}-\\d{3}-\\d{1}|\\d{1}-...\" of the type ISBN-type
with Saxon 9.7 (and error listener set in the same way) we get:
XTTE1515: One or more validation errors were reported
but without the actual validation error being received on the error listener.
Should we register a special type of error listener for such cases?
I see that on the method ValidatingFilter.reportValidationError at some point you were delegating directly to the error handler, was this changed sometime between 9.6 and 9.7?
Files
Updated by Michael Kay over 7 years ago
What API calls are you using to invoke the validation?
Updated by Michael Kay over 7 years ago
I've actually got a test with this data from some previous report, and it's working fine for me, so there must be some detail of the way you are invoking the transformation that's different from my test. Can you come up with a repro?
There have indeed been changes in this area: the native mechanism for reporting validation errors is now the InvalidityHandler, which was introduced because it does not require creating an expensive Exception object in order to report each validity error, when the Exception is never actually thrown. But in the JAXP case we use an InvalidityHandlerWrappingErrorListener, which wraps the validation error in a ValidationException and passes it on to the ErrorListener.
Updated by Radu Coravu over 7 years ago
Sorry for the delay, I also cannot reproduce the issue using simple JAXP code:
public static void main(String[] args) throws TransformerException {
LicenseInformationProviderUtil.setEnterpriseLIProviderForTests();
TransformerFactoryImpl factory = new EnterpriseTransformerFactory();
try{
Transformer newTransformer = factory.newTransformer(new SAXSource(new InputSource("file:/C:/Users/radu_coravu/Desktop/source/BookStore.xsl")));
newTransformer.setErrorListener(new ErrorListener() {
@Override
public void warning(TransformerException exception) throws TransformerException {
System.err.println("111");
exception.printStackTrace();
}
@Override
public void fatalError(TransformerException exception) throws TransformerException {
System.err.println("111");
exception.printStackTrace();
}
@Override
public void error(TransformerException exception) throws TransformerException {
System.err.println("111");
exception.printStackTrace();
}
});
StringWriter sw = new StringWriter();
newTransformer.transform(new StreamSource("file:/C:/Users/radu_coravu/Desktop/source/BookStore.xml"), new StreamResult(sw));
System.err.println(sw);
} catch(Exception ex){
System.err.println("FINAL THROW ");
ex.printStackTrace();
}
}
so you can probably close this one, I'll comment back on it if I find some kind of setting which needs to be set to the code above in order to reproduce the functionality.
Updated by Radu Coravu over 7 years ago
It seems that when running from Oxygen the invalidity handler used here "com.saxonica.ee.validate.ValidatingFilter.reportValidationError(ValidationFailure, boolean, Location)" is an instance of com.saxonica.ee.validate.InvalidityReportGeneratorEE.
When running from the command line it is an instance of "net.sf.saxon.lib.InvalidityHandlerWrappingErrorListener" which probably delegates to the standard error listener set on the transformer.
I will keep digging, see how we end up with the InvalidityReportGeneratorEE being used and what it is exactly.
Updated by Radu Coravu over 7 years ago
I took the latest code for "com.saxonica.config.EnterpriseConfiguration" from your saxonica repository and using it Oxygen also reports the validation problem.
It seems that your fixes for:
https://saxonica.plan.io/issues/3138
also fix as a side effect this problem.
Updated by Michael Kay over 7 years ago
- Status changed from New to Closed
It seems this problem can be closed: please re-open if that's not the case.
Updated by Radu Coravu over 7 years ago
I do not have the right to reopen issues (actually I also do not have the right to edit messages I posted on existing issues). But if after we update to the next Saxon version we still see the problem I will comment on this issue.
Please register to edit this issue