This project has moved and is read-only. For the latest updates, please go here.

xpath not working

Topics: User Forum
Mar 5, 2011 at 3:33 PM
Edited Mar 5, 2011 at 3: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?