Bug #6068
closedThe "NNN validation errors were reported" message.
100%
Description
See https://saxonica.plan.io/boards/3/topics/9433
If a validation episode finds one or more invalidities, then at the end of validation, several things may happen:
(a) A summary message of the form Error on line 1 column 60 XQDY0027 Two validation errors were reported. First error: ....
(b) An exception may be thrown
(c) When running from the command line, a return code may be returned to the shell.
Which of these actions is appropriate depends on what API was used to invoke validation. In some cases it is under our control, in other case we are expected to conform to the rules of an API such as JAXP. Unfortunately the JAXP API is very unclear on these things.
We addressed some of this in bug #5953, especially the question of the final exception.
Invalidity in general should not be treated as an error. However, when validation is invoked from XSLT or XQuery, any invalidity is a fatal error (and validation can stop as soon as a single error is found). In the JAXP interface, invalidity is reported by a callback to the supplied ErrorHandler, but it's a little vague as to which of its methods should be called: the consensus seems to be to call error().
There doesn't seem to be anything in any of the API specs to justify the final summary message (which is sent to the configuration's Logger, not to the registered ErrorHandler or InvalidityHandler). But perhaps it's useful when running from the command line?
It's worth remembering that many applications just want to confirm that the document is valid. Perhaps the s9api SchemaValidator
should have a simple way of asking that question without fiddling about with InvalidityHandler callbacks?
Please register to edit this issue