Xpath select all tr after second tr

c# html-agility-pack xpath

Question

I using HtmlAgilityPack i have a html of table

<TABLE class=default cellSpacing=0 width="95%" border=0 name="LISTA_MOV"><TBODY>
<TR>
<TD class=normal colSpan=5 align=center>ACCOUNT IN&nbsp;EUR: ES1030580147982720000036 - HAZERA ESPAÑA</TD></TR>
<TR>
<TD class=columnas vAlign=top width=80 align=center>Date</TD>
<TD class=columnas vAlign=top width=60 align=center>Value date</TD>
<TD class=columnas vAlign=top align=center>Reference</TD>
<TD class=columnas vAlign=top align=center>Amount</TD>
<TD class=columnas vAlign=top align=center>Balance</TD></TR>
<TR>
<TD class=columnas vAlign=top width=80 align=center><INPUT onclick="sortTable('LISTA_MOV',0,true,'Date');" alt="Ordenar Ascendente" src="/BE/util_apoyo/img/esp/orden_1.gif" type=image border=0 name=Sort>&nbsp;<INPUT onclick="sortTable('LISTA_MOV',0,false,'Date');" alt="Ordenar Descendente" src="/BE/util_apoyo/img/esp/orden_2.gif" type=image border=0 name=Sort_Date_down0></TD>...

when i trying to date,(that in the td with date value) with Xpath "//tr//td[1]"

 GeneralUtils.GetListDataFromHtmlSourse(PageData, "//tr//td[1]");

i getting 40 values and the two fist one i don't need they are " nbsp;" and "Date", sow i just need to fix my Xpath that will retur me all tr after second(or more in other case)

How can i need to change Xpath //tr//td[1] that it will look for tr after second tr elements.

Accepted Answer

like DGibbs said you can use position, apply it like:

GeneralUtils.GetListDataFromHtmlSourse(PageData, "//tr[position() > 2]//td[1]");

Popular Answer

You can try using XPath position() filter, for example :

//tr[position() > 2]//td[1]



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why