I am trying to get the inner text from a node but it has child nodes and its text is in the middle of its child entries i.e:
<script1> <p1>lalala</p1> "script text" </script1>
The code I need is inside script1, but if I try and get innertext I get all of the inside of p1 too..
Cannot figure it out.
HtmlDocument doc = new HtmlDocument(); doc.Load(MyTextHtml); HtmlNode node = doc.DocumentNode.SelectSingleNode("//p1/following-sibling::text()"); Console.WriteLine(node.InnerText.Trim());
will output this:
Here is link on XPATH axes that should get you started.