Je veux extraire le texte d'une source HTML. J'essaie avec c # et htmlagilitypack dll.
La source est:
<table>
<tr>
<td class="title">
<a onclick="func1">Here 2</a>
</td>
<td class="arrow">
<img src="src1" width="9" height="8" alt="Down">
</td>
<td class="percent">
<span>39%</span>
</td>
<td class="title">
<a onclick="func2">Here 1</a>
</td>
<td class="arrow">
<img src="func3" width="9" height="8" alt="Up">
</td>
<td class="percent">
<span>263%</span>
</td>
</tr>
</table>
Comment puis-je obtenir le texte Here 1 et Here 2 du tableau?
HtmlDocument htmlDoc = new HtmlDocument();
htmlDoc.LoadHtml("web page string");
var xyz = from x in htmlDoc.DocumentNode.DescendantNodes()
where x.Name == "td" && x.Attributes.Contains("class")
where x.Attributes["class"].Value == "title"
select x.InnerText;
pas si jolie mais devrait marcher