【发布时间】:2012-02-29 19:35:43
【问题描述】:
假设我有这个代码:
<p dataname="description">
Hello this is a description. <a href="#">Click here for more.</a>
</p>
如何选择p的nodeValue但排除a及其内容?
我当前的代码:
$result = $xpath->query("//p[@dataname='description'][not(self::a)]");
我选择$result->item(0)->nodeValue;
【问题讨论】:
标签: php xml dom xpath domdocument