import glob import sys from pathlib import Path from pprint import pprint if __name__ == '__main__': if sys.version_info <= (3, 5): sys.exit('ERROR: You need at least Python 3.5 to run this tool') try: from lxml import etree except ImportError: sys.exit('ERROR: You need to install the Python lxml library') try: import xmlschema except ImportError: sys.exit('ERROR: You need to install the xml schema library') schemaFiles = glob.glob('*.xsd') for schemaFile in schemaFiles: print("Checking file: {0}".format(schemaFile), end="") xs = xmlschema.XMLSchema(schemaFile) print("OK") print ("{0} XSD schemas checked".format(len(schemaFiles)))