diff --git a/utils.py b/utils.py index 935cd34824eb39978e73d5d410e746ec9c214faa..e947e48758f37ecb0b4536ba07dde1e9e0f2c871 100644 --- a/utils.py +++ b/utils.py @@ -40,11 +40,16 @@ def get_xsd(cfg, xsd_version=None, xml_str = None): url = baseURL + 'v' + xsd_version + '/' + filename else: root = parse(xml_str) - for item in root.attrib.items(): - x = item[1].split() - for url in x: - if url.endswith(filename): - break + item = root.attrib.get('schemaVersion') + if item: + url = baseURL + 'v' + item + '/' + filename + else: + for key in root.attrib: + if key.endswith('schemaLocation'): + x = root.attrib.get(key).split() + for url in x: + if url.endswith(filename): + break if uri_validator(url): try: r = requests.get(url)