Skip to content
Snippets Groups Projects
Commit cf336386 authored by Maximilian Gruber's avatar Maximilian Gruber
Browse files

add mathml validation script

parent 5b55f9c7
No related branches found
No related tags found
No related merge requests found
import os
import lxml.etree as et
#mathml_object_path = os.path.abspath("mathml_test.xml")
mathml_object_path = os.path.abspath("iir_filter.xml")
mathml_schema_path = os.path.abspath("app/report/mathml3/mathml3.rng")
print(f"Expression: {mathml_object_path}")
print(f"Schema : {mathml_schema_path}")
try:
schema = et.RelaxNG(et.parse(mathml_schema_path))
expression = et.parse(mathml_object_path)
except et.XMLSyntaxError as e:
print("Provided schema or expression not valid XML. Please check.")
print(f"Error log: {e}")
else:
validation_result = schema.validate(expression)
print(f"Expression {'' if validation_result else '_not_ '}valid according to RelaxNG schema.")
if not validation_result:
print("Error log:")
print(schema.error_log)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment