HtmlAgilityPack pulling extra text from a block of html
See the question and my original answer on StackOverflowYou could do it like this (in a console app sample):
HtmlDocument doc = new HtmlDocument();
doc.Load(MyTestFile);
foreach(var node in doc.DocumentNode.SelectNodes("//div[@id='playerStats']/div/span"))
{
Console.WriteLine(node.InnerText + " " + (node.NextSibling != null ? node.NextSibling.InnerText : null));
}
NextSibling is the next node after a given node with the same parent. It may not exist if the current node is the last child of a parent.
Note I have explicitely set element types to DIV for initial selection as it's better in terms of performance. (* matches any node).