Commit b3c039e0 authored by Alvin Noe Ladines's avatar Alvin Noe Ladines
Browse files

Fix issue #500

parent a1a5478c
Pipeline #94829 passed with stages
in 24 minutes and 13 seconds
......@@ -17,6 +17,7 @@ import os
import re
import numpy as np
from xml.etree import ElementTree
from lxml import etree
from nomad.parsing.file_parser import FileParser
......@@ -53,6 +54,13 @@ class XMLParser(FileParser):
self._file_handler = ElementTree.parse(self.open(self.mainfile)).getroot()
except Exception:
self.logger.error('failed to load xml file')
try:
# I cannot use the lxml XMLParser directly because it is not compatible with
# the ElementTree implementation.
xml = etree.parse(self.open(self.mainfile), parser=etree.XMLParser(recover=True))
self._file_handler = ElementTree.fromstring(etree.tostring(xml))
except Exception:
pass
self.init_parameters()
return self._file_handler
......
......@@ -39,6 +39,7 @@ mdtraj
mdanalysis
nomadcore
nomad_dos_fingerprints
lxml
# [infrastructure]
optimade==0.8.1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment