Replace validator with xmlschema (XSD1.1 compliant) #816
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current validator is XSD 1.0 compliant. That means you can validate for order of elements, and number and type of elements.
I'd like to update to an XSD 1.1 compliant validator, as XSD 1.1 allows validation using patterns, and inter-element validation. For example, with XSD 1.0 you can require that a command has 7 parameters, and that their index is between 1 and 7, but with XSD 1.1 you can also require that they be unique.
My main interest at this point is to add range checking - allowing us to validate in XSD the allow range(s) for the command and message IDs, and to add exclusion ranges so that we can reserve items more obviously inside the allocated ranges.
The only Python XSD1.1 validate I can find is this one: https://github.com/sissaschool/xmlschema
This update is pretty much a direct replacement. Right now it drops one feature - the ability to turn off strict checking of the types. I've raised a question here to see if there is a way to do this: sissaschool/xmlschema#346
In many ways I prefer the existing parser, but there is no indication if or when it will get v1.1 parsing. Note that the existing parser is capable of doing the same kind of tests that I want, but only in Python, not in XSD. That is not really OK because we want others to be able to validate in their own programming languages if they so wish - so best to embed in the XSD file.