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

XPath expression to find heading tags <h1>

Topics: Developer Forum, User Forum
Jun 24, 2008 at 5:00 PM
Edited Jun 25, 2008 at 9:59 AM

I'd be grateful if someone could nudge me in the right direction here. I have just downloaded the Agility Pack and am playing, however I'm a little stuck. I want to find all "<h1>"  tags, for example, on a page so I thought the best way was to adapt one of the examples.

So, I tried this line 


atts = _doc.DocumentNode.SelectNodes("//h1");



However it always returns null - the document definately contains heading tags and that is the correct XPath expression.

So I've missed something - but what?

Thanks for any help

Jun 25, 2008 at 10:30 AM
The forums seems to be *very* quiet, but incase anyone is listening - I'm having very little success with htmlagilitypack as it doesnt seem to work that well. For example I pointed the sample code 'GetDocLinks' at '' and all it returned was:

Linked urls:
Referenced urls:

It also completely failed to pick out any other tags. SO - does anyone have recommendations for what's happning or perhaps another product with better support material.

Jul 11, 2008 at 10:24 AM
Did you check whether your html page is properly loaded ?