Htmlagilitypack select the subsidiary element
-
var td = htmlNode.SelectNodes("td").Select(x => x.InnerText).ToList(); <td align="right"> <img src="templates/images/countmax.png"></td>
In variable
td
Only elements with currentstd
but I would like to see the Gateimg
I saw him, too.
-
Your code can be rewritten:
var tdElements = htmlNode.SelectNodes("td").ToList();
Now the variable tdElements contains a list of objects
HtmlNode
each of which corresponds to the element<td>
and contains all the information provided. In particular, from the collectiontdElements[0].ChildNodes
a subsidiary may be removed<img>
:var imgElement = tdElements[0].ChildNodes.FindFirst("img");
And still, there's a way to extract `InnerText' from each element:
var innerText = tdElements[0].InnerText;