Suppress std err output during Schema validation
Added by Trevor Lawrence over 1 year ago
Hi there.
I'm performing XML Schema validation using Saxon-EE 11.5.0.0. I'm using the s9api and my own InvalidityHandler
to capture errors. If a document being validated has a schema violation, then a message is always being output to the standard error stream of my application.
Is there a way to either redirect this output or else suppress it, preferably when configuring a SchemaValidator
?
Thanks,
-Trevor
Replies (6)
Please register to reply
RE: Suppress std err output during Schema validation - Added by Michael Kay over 1 year ago
Could you be more specific please? What message is being output to stdErr? Are messages being output related to individual invalidities, or just a single message at the end?
RE: Suppress std err output during Schema validation - Added by Trevor Lawrence over 1 year ago
Sorry for the confusion. There's a message for each invalidity and one at the end.
Here's an example output of what I'm talking about:
Error on line 1 column 10
FORG0001 Required attribute @Q{}requiredAttribute is missing on element <element>
Error on line 1 column 50
FORG0001 In content of element <element>: The content model does not allow element
<child3> to appear immediately after element <child1>. It must be preceded by <Q{}child2>.
Error on line 1 column 60
XQDY0027 Two validation errors were reported. First error: Required attribute
@Q{}requiredAttribute is missing on element <element>
RE: Suppress std err output during Schema validation - Added by Michael Kay over 1 year ago
OK, that definitely shouldn't be happening if you register your own InvalidityHandler. Can you supply a repro so we know exactly what you are doing?
RE: Suppress std err output during Schema validation - Added by Trevor Lawrence over 1 year ago
Michael Kay wrote in RE: Suppress std err output during Schema validation:
OK, that definitely shouldn't be happening if you register your own InvalidityHandler. Can you supply a repro so we know exactly what you are doing?
Can do, once I get a moment later in the day.
RE: Suppress std err output during Schema validation - Added by Trevor Lawrence over 1 year ago
After eliminating some of the extraneous code I realized that it's only the final summary message that's still being output to stderr once my InvalidityHandler
is set.
Is there a way to intercept that somehow?
RE: Suppress std err output during Schema validation - Added by Michael Kay over 1 year ago
I've raised an issue regarding this message at https://saxonica.plan.io/issues/6068
It's complicated because of the number of different APIs for invoking validation, including the ability to invoke validation from XSLT and XQuery (in which case any invalidity is fatal).
I agree that in the case of validation invoked from the s9api SchemaValidator, the summary message (which is sent to the Configuration's Logger; the default Logger writes to StdErr) is inappropriate.
Please register to reply