我得到了一个类似以下示例的XML:
<article>
<body>
<title>I <underline><bold>LOVE</bold></underline> Coding</title>
</body>
</article>
我想要得到 node title的全文.
$xml=simplexml_load_file("file.xml");
$title=$xml->xpath('//title')??[];
echo (string)$title;
我似乎无法更深入地抓住带下划线/粗体的XML部分.
我希望结果是字符串I LOVE Coding
.
我怎样才能做到这一点呢?我只得到I Coding
分.
我也试了xpath('string(//title)')
次,但没有结果.