I'm using HTML agility pack to extract text from a node.
var sb = new StringBuilder();
foreach (HtmlNode innernode in node.SelectNodes("//*[not(self::script or self::style)]/text()[not(normalize-space(.)='')]"))
{
sb.Append(innernode.InnerText);
}
Console.WriteLine(sb.ToString());
I'm using this code. I want to extract text from "node" and it's child nodes, but this xpath query returns result from whole html document (it starts search from root node I guess). I know this is stupid, but how can I update XPath so that it searches only in "node"s child nodes :)
Thanks
//means "start at the top of the document and go to any depth" so it is doing exactly what you said - matt./- matt