XPath expression fails

May 18, 2010 at 10:31 AM

I'm trying to extract the href locations from http://www.actuelewaterdata.nl/waterstandNAP/lokaties.html

I use the expression:

HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes( "//div[class='sublinks']" );

but I keep getting back a null pointer. Anyone know why this Xpath expression doesn't work?

May 18, 2010 at 12:32 PM

I refined my XPath expression using the FireFox XPather add-on and it now works:

HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes( "//div[@class='sublinks']/a[@target='subcontent']" );