我正在尝试获取article/div/p
中的内容,但仅获取<br>
标记后的日期。怎么做?
<article>
<h2>Man rescued after falling into Crater Lake</h2>
<p class="summary highlight">
Man rescued after falling 800 feet into Crater Lake in Oregon
</p>
<div class="body">
<p>by Joe Sutton<br>
June 11, 2019
</p>
</div>
</article>
$expression = "article/div/p";
答案 0 :(得分:1)
此XPath,
//br/following-sibling::text()
将选择br
之后的所有后续同级文本节点。