Skip to content

Commit 4ed4bc9

Browse files
committed
[ModelicaSystem] replace ET.parse() with ET.ElementTree(ET.fromstring())
read the file content and work on this string see: https://stackoverflow.com/questions/647071/python-xml-elementtree-from-a-string-source
1 parent f10e4e0 commit 4ed4bc9

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

OMPython/ModelicaSystem.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,8 @@ def _xmlparse(self, xml_file: pathlib.Path):
514514
if not xml_file.is_file():
515515
raise ModelicaSystemError(f"XML file not generated: {xml_file}")
516516

517-
tree = ET.parse(xml_file)
517+
xml_content = xml_file.read_text()
518+
tree = ET.ElementTree(ET.fromstring(xml_content))
518519
rootCQ = tree.getroot()
519520
for attr in rootCQ.iter('DefaultExperiment'):
520521
for key in ("startTime", "stopTime", "stepSize", "tolerance",

0 commit comments

Comments
 (0)