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

SelectSingleNode return null...

Topics: User Forum
Jan 20, 2012 at 4:52 PM
Edited Jan 20, 2012 at 4:53 PM

code is:

HtmlNode n = html.DocumentNode.SelectSingleNode("/html/body/div[@id=content]/table/tr/th/div/a");


when in debug, i manualy can found this node using ChildNodes from root.

but, why XPath cannot do it?(Windows XP, dotNET 4.0)

this page.

Jan 21, 2012 at 7:41 PM



You have missed the quotes around content!


If you use: "/html/body/div[@id='content']/table/tr/th/div/a"

Then it should work!

Just in case you haven't downloaded these two programs, you should. They make xpath a bit easier!

HAP Explorer

HAP Testbed

// Anders

Jan 21, 2012 at 8:33 PM

the reason was there i even dont try to look...

big thanks, but it means that not all expressions that System.Xml.XmlDocument support are supported.(it works without quotes )