gpt4 book ai didi

php - 在 XML 和 PHP 中解析 MathML

转载 作者:行者123 更新时间:2023-11-29 00:50:21 25 4
gpt4 key购买 nike

我需要使用 php 解析 XML 中的 MathML

这是我的 XML 中 MathML 的示例代码 (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>

请帮我在 php 中解析 XML 中的 mathml

最佳答案

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

编辑:

<?php
$xml = simplexml_load_string($xmlstring);
var_dump($xml)
echo $xml->yournode;
?>

关于php - 在 XML 和 PHP 中解析 MathML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8847867/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com