Skip to content
Snippets Groups Projects
Commit bfb7715b authored by Thomas Bock's avatar Thomas Bock :speech_balloon:
Browse files

schema declaration contains version

parent 09ac3394
No related branches found
No related tags found
No related merge requests found
......@@ -7,8 +7,7 @@
"dir":"."
},
"xsd":{
"dir":"../DCC/schemata",
"file": "DCC_v1.9.xsd",
"url": "https://intranet.ptb.de/fileadmin/dokumente/intranet/abteilungen/abteilung_1/Digitaler_Kalibrierschein/DCC"
"dir":"../DCC",
"file": "dcc.xsd"
}
}
......@@ -48,11 +48,14 @@ def parse(xml_str):
return tree
def get_xsd_version(xsd_str):
tree = parse(xsd_str)
for annotation in tree.findall("w3:annotation", ns):
version_text = annotation.find("w3:documentation", ns).text
return version_text
"""The version is tag is a declaration and so
not part of the parse tree
"""
root = parse(xsd_str)
if root.tag.endswith("schema"):
return root.attrib.get("version", "")
else:
return ""
def validate(xml_str, xsd_str):
tree = parse(xml_str)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment