soften xml formation element

This commit is contained in:
Jean-Marie Place 2021-12-03 10:46:14 +01:00
parent d435f3b835
commit 0a000afba4

View File

@ -180,8 +180,14 @@ def formation_import_xml(doc: str, import_tags=True):
log("formation_import_xml: invalid XML data")
raise ScoValueError("Fichier XML invalide")
f = dom.getElementsByTagName("formation")[0] # or dom.documentElement
D = sco_xml.xml_to_dicts(f)
try:
f = dom.getElementsByTagName("formation")[0] # or dom.documentElement
D = sco_xml.xml_to_dicts(f)
except:
raise ScoValueError(
"Le document xml ne correspond pas à un programme BUT. (élément 'formation' inexistant "
"par exemple)."
)
assert D[0] == "formation"
F = D[1]
# F_quoted = F.copy()