From 9060d420faeb458e9d7365322eafd9eeb466c808 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Sat, 14 Feb 2015 15:31:36 -0500 Subject: [PATCH] removes rng files after use and prints more information if XML file does not conform to RelaxNG --- src/utils/xml_validate.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/utils/xml_validate.py b/src/utils/xml_validate.py index d4a030cb5..699ac3f4c 100755 --- a/src/utils/xml_validate.py +++ b/src/utils/xml_validate.py @@ -79,10 +79,15 @@ for xml_file in xml_files: relaxng = etree.RelaxNG(relaxng_doc) # validate xml file again RelaxNG - if relaxng.validate(xml_tree): + try: + relaxng.assertValid(xml_tree) print(BOLD + OK + '[VALID]' + ENDC) - else: + except etree.DocumentInvalid as e: print(BOLD + FAIL + '[NOT VALID]' + ENDC) + print(" {0}".format(e)) + + # remove rng file + os.remove(rng_file) # trang command failed else: