Validation Logging
The validation logging framework superficially mimics Python’s logging
framework, however instead of formatting and outputting validation logging
messages as soon as they are generated, they are stored in an object that
provides list functionality, the ability to collate repeated results,
and to serialise itself as plain text, CSV or JSON.
The ValidationLogger is a list of ValidationResult objects.
Each ValidationResult has:
A status, being
GOOD,INFO,WARN,ERRORorSKIPA code reflecting what it relates to - these are an
enumatValidationCodeA location
strto identify where in the document the result appliesA message
strto describe in more detail the result of the check
To decide whether or not the validation passed or failed a relevant
subset of checks, the
ValidationPassChecker
module offers “pass checkers” that include
appropriate check codes, for example the
XmlPassChecker has a _check_codes
list that contains all the appropriate ValidationCode values
for which check failures would indicate that the input is not
valid XML, whereas the
TtmlPassChecker has TTML-specific check failures.
Typically a ConstraintSet
would check each appropriate ValidationPassChecker that is
relevant for its purpose, in its static
summarise method, so that the results can be used to establish
where the error lies, for example the input document might be valid
XML but contain TTML errors.