这是我的xpath查询:
//div[contains(@class,"group") and contains(@class,"group-even")]//div[descendant-or-self::text()]
将从以下内容中获取内容:
<div class="service-group">
<div class="group group-even">...</div>
<div class="group">...</div>
</div>
哪个好,但它也需要以下内容:
<div class="service-group">
...
<div id="lastCollectionHours" class="group lastCollectionHours">...</div>
...
</div>
和
<div class="service-group">
...
<div id="retailHours" class="group group-even retailHours">
...
</div>
我想排除这两个div,我该怎么办?
答案 0 :(得分:0)
排除的基础尚不清楚,但从字面上排除了您指定的两个节点:
div[
contains(@class, "group") and
not(
@id = "retailHours" or
@id = "lastCollectionHours"
)
]//...