I'm evaluating Saxon EE 9.4 and trying to validate an XML document against our XSD.

I purposely entered wrong data in the XML document and Saxon is able to spot the error (see message below).

Validation error at /asset[1]/assetId[1] on line 3 column 26 of MBS1172478.xml:
  XTTE1510: The content "DANNY2" of element <assetId> does not match the required simple
  type. Cannot convert string "DANNY2" to an integer (See
  http://www.w3.org/TR/xmlschema11-2/#cvc-datatype-valid clause 1)
Validation error on line 83 column 9 of MBS1172478.xml:
  XTTE1510: One or more validation errors were reported

In Java, I'm able to see the above message in my console in red (meaning it was sent to stderr).

Problem is, :

1. The above message is sent to stderr by schemaValidator.validate() .
2. The resulting exception (SaxonApiException) doesn't contain the said error message in its message or stacktrace.

My questions are :

1. How do I prevent schemaValidator.validate() from sending it to stderr ?
2. How do I capture it in a string instead ?

Here's what my java code looks like :

Processor processor = new Processor(true);
SchemaManager schemaManager = processor.getSchemaManager();
Source schemaFile = new StreamSource(new File("D:\\schema\\my_schema.xsd"));
try {
schemaValidator = schemaManager.newSchemaValidator();
} catch (SaxonApiException e) {

                try {
        instanceFile = new StreamSource("my_xml_doc.xml");
} catch (SaxonApiException e) {