I’d like to find out what element type I got in my loop when using htmlagility 1.4
I got this simple table
<table>
<tr>
<td>
<h2>Title1</h2>
<p>Text...</p>
<h2>Title2</h2>
<p>More Text...</p>
</td>
</tr>
</table>
I load it with
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(tableString);
HtmlNode node = doc.DocumentNode.SelectSingleNode("//table/tr/td/*");
foreach (var infoNode in node)
{
// Print the actual element type
Console.WriteLine(infoNode.InnerText.Trim());
}
I could of course analyze the infoNode.OuterHtml but that sucks a bit. And the infoNode.NodeType simply returns ‘Element’
Anyone keen to help me? 🙂
Obviously the answer was to use the Name property