我尝试从下面的div标签中提取每个text(),但是在a标签之间没有text()。
我用这个没有成功:
//div[@class="availability"]/*[not(self::a)]/text()
这是html
<div class="availability">
Available. Delivered from UK <br><a href="test.com">Click for more</a>
</div>
<div class="availability">
Available. Delivered from HK <br><a href="test.com">Click for more</a>
</div>
<div class="availability">
Available. Delivered from USA <br><a href="test.com">Click for more</a>
</div>
<div class="availability">
Available. Delivered from DE <br><a href="test.com">Click for more</a>
</div>
感谢您引导我走向正确的方向!
答案 0 :(得分:1)
//div[@class="availability"]/text()