Content of NextSibling not being printed out
See the question and my original answer on StackOverflowThat's because the next sibling of this DIV element is not the other DIV, but the text between the two DIVs (yes, they are nodes too). If you want the next sibling of DIV type, this is what you should do:
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.Load("Billing106.htm");
foreach (HtmlNode div in doc.DocumentNode.SelectNodes("//div[starts-with(., ' SEMANTIC:')]"))
{
richTextBox1.Text += "SC: " + div.SelectSingleNode("following-sibling::div").InnerText.ToString();
}
See here for an explanation of XPATH axes: XPATH Axes