Skip to content

Commit 03554c2

Browse files
authored
chore(xml-upload): print XML validation errors when xmlupload fails due to validation (DEV-387) (#149)
1 parent e0c42c5 commit 03554c2

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎knora/dsplib/utils/xml_upload.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -580,12 +580,12 @@ def validate_xml_against_schema(input_file: str, schema_file: str) -> bool:
580580
xmlschema = etree.XMLSchema(etree.parse(schema_file))
581581
doc = etree.parse(input_file)
582582

583-
is_valid = False
584-
585583
if xmlschema.validate(doc):
586-
is_valid = True
587-
588-
return is_valid
584+
return True
585+
else:
586+
print("The input data file cannot be uploaded due to the following validation error(s):")
587+
for error in xmlschema.error_log:
588+
print(f" Line {error.line}: {error.message}")
589589

590590

591591
def convert_ark_v0_to_resource_iri(ark: str) -> str:

0 commit comments

Comments
 (0)