4

I'm using schematron for validating large xml files (several megabytes). Validation is quite fast if files are ok (if there is no errors). But when the error count increases so increases the execution time of the schematron validation time.

Is there any way to stop the schematron XSLT-validation when for example 200 errors are found. That would help because if there are big files which contain hundreds of occurrences of the same error it would certainly be enough to report only first errors and ask the user to validate file again after correcting those.

David Hall
  • 32,624
  • 10
  • 90
  • 127
juhako
  • 489
  • 4
  • 7

1 Answers1

1

You should be able to get very close to your requirement by combining the Schematron Terminator Validator with Schematron Phases

The terminator validator allows for a schematron validation to fail when the first error is hit.

Phases allow for validation to be broken up into stages and carried out progressively.

One or both of these in combination should get you close to what you want - perhaps putting all your rule classes into phases then running each phases with the terminator would give a good result, allowing users to be informated of several errors at once.

David Hall
  • 32,624
  • 10
  • 90
  • 127
  • Yep, that's closer to what I need. So the ideal solution would be to have Schematron Terminator Validator with configurable (or somehow editable) value for count of errors before terminating. I guess this does not exist. Do you have any idea where to start if I want to do that by myself? – juhako May 27 '11 at 10:49
  • @user771744 Sorry, no - I'm not even sure if it is possible. Though perhaps look at introducing an xslt variable to count the errors, increment it in the process-message template then only call the terminate message once over your desired count. Don't have time to try that an my schematron is very very rusty but that is where I'd start. – David Hall May 27 '11 at 10:52
  • Yep, maybe something like that could do it. Have to look at that. – juhako May 27 '11 at 11:45
  • The Schematron Terminator Validator is now only on the Wayback Machine, e.g.: http://web.archive.org/web/20110709074734/http://www.schematron.com/validators/iso_schematron_terminator.xsl – Tony Graham May 28 '21 at 20:26