1
0
forked from ScoDoc/ScoDoc

Merge pull request 'soften xml formation element' (#191) from jmplace/ScoDoc-Lille:fix_import_xml into PNBUT

Reviewed-on: https://scodoc.org/git/viennet/ScoDoc/pulls/191
This commit is contained in:
Emmanuel Viennet 2021-12-03 11:26:17 +01:00
commit ec93a8cdbc

View File

@ -180,8 +180,14 @@ def formation_import_xml(doc: str, import_tags=True):
log("formation_import_xml: invalid XML data") log("formation_import_xml: invalid XML data")
raise ScoValueError("Fichier XML invalide") raise ScoValueError("Fichier XML invalide")
f = dom.getElementsByTagName("formation")[0] # or dom.documentElement try:
D = sco_xml.xml_to_dicts(f) 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" assert D[0] == "formation"
F = D[1] F = D[1]
# F_quoted = F.copy() # F_quoted = F.copy()