Reputation: 213
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 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> <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.
Upvotes: 0
Views: 2059
Reputation: 117
like DGibbs said you can use position, apply it like:
GeneralUtils.GetListDataFromHtmlSourse(PageData, "//tr[position() > 2]//td[1]");
Upvotes: 1
Reputation: 4739
Why not be more specific in your XPath? Something like:
/TABLE[@name='LISTA_MOV']/tr[position() > 1]/td[1]
Upvotes: 1
Reputation: 89295
You can try using XPath position()
filter, for example :
//tr[position() > 2]//td[1]
Upvotes: 3