1

I need to parse the MathML in XML using php

Here the sample code for MathML in my XML (ref):

<mathDisplay numbered="yes" id="van005-mdis-0001">
  <mrow>
    <mrow selected="true">
      <msup><mo>sin</mo><mn>2</mn></msup>
      <mi>&theta;</mi>
      <mo>+</mo>
      <msup><mo>cos</mo><mn>2</mn></msup>
      <mi>&theta;</mi>
      <mo>=</mo><mn>1</mn>
    </mrow>
  </mrow1>
</mathDisplay>

Please help me to parse the mathml from XML in php

4

1 回答 1

1

您可以使用SimpleXML解析 XML 文件。

编辑:

<?php
$xml = simplexml_load_string($xmlstring);
var_dump($xml)
echo $xml->yournode;
?>
于 2012-01-13T08:50:14.820 回答