Skip to content

Commit c4fabc5

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 a9442b5 commit c4fabc5

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
@@ -513,7 +513,8 @@ def _xmlparse(self, xml_file: pathlib.Path):
513513
if not xml_file.is_file():
514514
raise ModelicaSystemError(f"XML file not generated: {xml_file}")
515515

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

0 commit comments

Comments
 (0)