May 7, 2012 at 11:16 AM
Edited May 7, 2012 at 11:20 AM
|
hello,
i need to get all the title attributes value ,only those who in the <td class = val>
Code:
<td class="val"><img class="r3" src="img/x.gif" alt="ind" title="ind" />
750 </td>
|
|
May 11, 2012 at 4:03 PM
Edited May 11, 2012 at 4:05 PM
|
Here's how I would do it:
HtmlWeb.LoadAsync(url, handleResults);
public void handleResults(object o, HtmlDocumentLoadCompleted args)
{
IEnumerable<HtmlNode> columns = args.Document.DocumentNode.Descendants("td").Where(x => x.GetAttributeValue("class", "").Equals("val"));
}
If you're looking to get the title inside of each image inside of the column, and assuming each column has exactly one image in it, you could add to this,
IEnumerable<string> titles = columns.Select(x => x.Descendants("img").Single().GetAttributeValue("title", ""));
|
|