2

我正在寻找一个可以将 MathML 转换为中缀和中缀为 MathML 的 C/C++ 库,例如:

<?xml version="1.0" encoding="UTF-8"?>
<math xmlns="http://www.w3.org/1998/Math/MathML">
  <apply>
    <times/>
    <cn type="integer"> 2 </cn>
    <ci> x </ci>
  </apply>
</math>

该库会将 mathml 转换为 2*x。或者给定 x+sin (t) 我得到以下 mathml

<?xml version="1.0" encoding="UTF-8"?>
<math xmlns="http://www.w3.org/1998/Math/MathML">
  <apply>
    <plus/>
    <ci> x </ci>
    <apply>
      <sin/>
      <ci> t </ci>
    </apply>
  </apply>
</math>

我知道如何编写这样的库,但如果可能的话,我宁愿不重新发明轮子。不能使用 Java,因为我必须能够将库链接到非托管代码。

4

1 回答 1

2

我自己从未使用过它,但看起来 libSBML 可能会满足您的目的:

http://www.google.co.uk/search?q=libsbml+convert+mathml+infix

http://sbml.org/Software/libSBML/docs/cpp-api/libsbml-features.html

在本页面:

http://sbml.org/Software/libSBML/docs/cpp-api/

它说:

“libSBML 公式解析器经过精心设计,因此从 MathML 到中缀字符串表示法的转换是可能的,并且对数学表达式结构的破坏最小。”

并有一个你正在尝试做的例子......

于 2011-12-05T22:05:50.610 回答