Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(xml-upload): print XML validation errors when xmlupload fails due to validation (DEV-387) #149

Merged
merged 2 commits into from Jan 28, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions knora/dsplib/utils/xml_upload.py
Expand Up @@ -566,12 +566,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 xml_upload(input_file: str, server: str, user: str, password: str, imgdir: str, sipi: str, verbose: bool,
Expand Down