From e3a491c247d8533ead472682ee0a4b2d4ea2bf67 Mon Sep 17 00:00:00 2001 From: Rolf Niepraschk <Rolf.Niepraschk@ptb.de> Date: Mon, 22 Jun 2020 12:05:13 +0200 Subject: [PATCH] For the internal XSD version, prefer the entry "schemaVersion" --- utils.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/utils.py b/utils.py index 935cd34..e947e48 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) -- GitLab