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 @@ ...@@ -7,8 +7,7 @@
"dir":"." "dir":"."
}, },
"xsd":{ "xsd":{
"dir":"../DCC/schemata", "dir":"../DCC",
"file": "DCC_v1.9.xsd", "file": "dcc.xsd"
"url": "https://intranet.ptb.de/fileadmin/dokumente/intranet/abteilungen/abteilung_1/Digitaler_Kalibrierschein/DCC"
} }
} }
...@@ -48,11 +48,14 @@ def parse(xml_str): ...@@ -48,11 +48,14 @@ def parse(xml_str):
return tree return tree
def get_xsd_version(xsd_str): def get_xsd_version(xsd_str):
tree = parse(xsd_str) """The version is tag is a declaration and so
for annotation in tree.findall("w3:annotation", ns): not part of the parse tree
version_text = annotation.find("w3:documentation", ns).text """
root = parse(xsd_str)
return version_text if root.tag.endswith("schema"):
return root.attrib.get("version", "")
else:
return ""
def validate(xml_str, xsd_str): def validate(xml_str, xsd_str):
tree = parse(xml_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