更新时间:2022-11-26 18:04:10
我将如何完成下一个兄弟姐妹 有没有更简单的方法 这个吗?
How would I accomplish the nextsibling and is there an easier way of doing this?
您可以使用:
tr/td[@class='name']/following-sibling::td
但我宁愿直接使用:
tr[td[@class='name'] ='Brand']/td[@class='desc']
这是假定:
将对其进行评估的XPath表达式的上下文节点是所有tr
元素的父级-在您的问题中未显示.
The context node, against which the XPath expression is evaluated is the parent of all tr
elements -- not shown in your question.
每个tr
元素只有一个td
属性的值为'name'
,只有一个td
属性的值为'desc'
.
Each tr
element has only one td
with class
attribute valued 'name'
and only one td
with class
attribute valued 'desc'
.