Skip to content

Commit

Permalink
chore(xml-upload): print XML validation errors when xmlupload fails d…
Browse files Browse the repository at this point in the history
…ue to validation (DEV-387) (#149)
  • Loading branch information
jnussbaum committed Jan 28, 2022
1 parent e0c42c5 commit 03554c2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions knora/dsplib/utils/xml_upload.py
Expand Up @@ -580,12 +580,12 @@ def validate_xml_against_schema(input_file: str, schema_file: str) -> bool:
xmlschema = etree.XMLSchema(etree.parse(schema_file))
doc = etree.parse(input_file)

is_valid = False

if xmlschema.validate(doc):
is_valid = True

return is_valid
return True
else:
print("The input data file cannot be uploaded due to the following validation error(s):")
for error in xmlschema.error_log:
print(f" Line {error.line}: {error.message}")


def convert_ark_v0_to_resource_iri(ark: str) -> str:
Expand Down

0 comments on commit 03554c2

Please sign in to comment.