<table>
<tr>...</tr>
....
<tr>NodeToSelect</tr>
<tr>..</tr>
<tr class="SomeClass">CurrentNode</tr>
...
</table>
我有一个HtmlNode对象,在某个函数中指示-tr class="SomeClass"CurrentNode-
:
string Proccess(HtmlNode node)
{
//need select
}
如何通过Xpath从此函数获取node -NodeToSelect-?
答案 0 :(得分:1)
preceding-sibling::tr[text()="NodeToSelect"]
preceding-sibling::tr[2]