【发布时间】:2021-10-20 18:11:54
【问题描述】:
我正在尝试使用 Xpath 获取文本直到第一个 <.hr>(忽略点)标记
<div class="entry">
<p> some text</p>
<p> some text2</p>
<p> some text3</p>
<p> some text4</p>
<hr>(get text part before this hr tag)
<p> some text5</p>
<hr>
<p> some text6</p>
</div>
试过了
//hr[1]/ancestor::div[@class="entry"]/text()
以及一些类似的变体,但无法获得预期的输出
【问题讨论】:
标签: html web-scraping xpath web-crawler