HtmlAgilityPack - Remove child nodes but retain inner text for the main node
See the question and my original answer on StackOverflowThis code:
HtmlDocument doc = new HtmlDocument();
doc.Load(MyTextHtml);
HtmlNode node = doc.DocumentNode.SelectSingleNode("//p1/following-sibling::text()");
Console.WriteLine(node.InnerText.Trim());
will output this:
"script text"
Here is link on XPATH axes that should get you started.