在 <br> 标记后获取字符串的 XPath 表达式
XPath expression to get a string after a <br> tag
我正在尝试获取 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";
这个 XPath,
//br/following-sibling::text()
select br
.
之后的所有后续同级文本节点
我正在尝试获取 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";
这个 XPath,
//br/following-sibling::text()
select br
.