Closed hsorby closed 2 years ago
It appears some OSes give you a segfault and others will return an empty string, both outcomes are undesirable.
So this PR solves this issue by picking up on any errors when using libXml2 to parse the generated model to "pretty print" the serialised model - which is a good addition. But since we already have an internal printMath
function in the printer to process the math strings I wonder if we should be using that to remove XML declarations? Seems like it might be a fairly common use-case to use an external library like libSBML to generate MathML to put into components and those fragments may be complete self-contained XML documents.
But perhaps this is really a future addition to that "model fixer" tool that we have previously discussed...
I have re-jigged the logging of errors to include the location (reset, or component) where the MathML error was detected. I think this makes more sense when the MathML is subsequently not printed but the rest of the model is.
Fixes #1024.