This project has moved. For the latest updates, please go here.

xpath not working

Topics: User Forum
Mar 5, 2011 at 2:33 PM
Edited Mar 5, 2011 at 2:36 PM

we have a simple html like this:

   <div id="main">
     <div id="sub">

C# code is:

foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//div[@id='sub']"))
first response give us what we want, but second a third is the same - div with id "sub", from the second it should be the div from the node element, but it is the div from documentnode. So the second is searching in whole document. Is it ok? Shouldn't it search just in the node element?