Skip to content

Commit

Permalink
change to allow for "<" in observable blocks to be read by standard X…
Browse files Browse the repository at this point in the history
…ML readers
  • Loading branch information
ASinanSaglam committed Sep 21, 2021
1 parent 872fc1a commit f34e29a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bionetgen/modelapi/bngparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,18 @@ def _parse_model_bngpl(self, model_obj) -> None:
with TemporaryFile("w+") as xml_file:
if self.bngfile.generate_xml(xml_file):
# TODO: Add verbosity option to the library
# print("Parsing")
self.parse_xml(xml_file.read(), model_obj)
xmlstr = xml_file.read()
# < is not a valid XML character, we need to replace it
xmlstr = xmlstr.replace('relation="<', 'relation="&lt;')
self.parse_xml(xmlstr, model_obj)
model_obj.reset_compilation_tags()
else:
raise ValueError("XML file couldn't be generated")
elif model_file.endswith(".xml"):
with open(model_file, "r") as f:
xml_str = f.read()
# < is not a valid XML character, we need to replace it
xmlstr = xml_str.replace('relation="<', 'relation="&lt;')
self.parse_xml(xml_str, model_obj)
model_obj.reset_compilation_tags()
else:
Expand Down

0 comments on commit f34e29a

Please sign in to comment.