You can pass that condition as a predicate, i.e. with XPath like:
//td[font[@color='#ff0000']]
Or you could traverse to the ParentNode of the nodes returned by your current XPath...
سؤال
I'm trying to extract a table on a webpage that has a red color for months with data. I've tried using an XPath with //font[@color='#ff0000']
which returns the months I want but I lose the year of those months. I'm thinking I would have to extract the months row by row and appending the year to the months. I may be missing something because I'm new to using HTMLAgilitypack. The table is from http://www.raws.dri.edu/cgi-bin/rawNAME.pl?idIAN1
<td> <b> 2014 </b> </td>
<td><font color=\"#ff0000\"> <b> Jan </b></font> </td>
<td><font color=\"#ff0000\"> <b> Feb </b></font> </td>
<td><font color=\"#ff0000\"> <b> Mar </b></font> </td>
<td> Apr </td>
<td> May </td>
<td> Jun </td>
<td> Jul </td>
<td> Aug </td>
<td> Sep </td>
<td> Oct </td>
<td> Nov </td>
<td> Dec </td>
المحلول
You can pass that condition as a predicate, i.e. with XPath like:
//td[font[@color='#ff0000']]
Or you could traverse to the ParentNode of the nodes returned by your current XPath...