I have been trying to round-trip documents created by libsedml.sf.net with the tool you created, however there are some snags:
The first is that the mathml output of jlibsedml seems off as example we get:
<math>
<math:apply>
<math:divide />
<math:ci>S21_s</math:ci>
<math:ci>S21_c</math:ci>
</math:apply>
</math>
note that the math element is in the SED-ML namespace in the result. However it should be in the mathml namespace ... (see also the schema where the math element is defined as being of type "math:Math". Since everything else is prefixed, you should have <math:math> or some such thing. For many tools it will be easier if it were written as;
<math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<divide />
<ci> S21_s </ci>
<ci> S21_c </ci>
</apply>
</math>
This again seems fixed, e.g. in a DataGenerator
<math:math xmlns:math="http://www.w3.org/1998/Math/MathML"><math:ci>M</math:ci></math:math>Last edit: Richard Adams 2016-07-27