XPath expression to find heading tags <h1>

Topics: Developer Forum, User Forum
Jun 24, 2008 at 4:00 PM
Edited Jun 25, 2008 at 8:59 AM
Hi,

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 

HtmlNodeCollection

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

JC
Jun 25, 2008 at 9: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 'http://www.w3schools.com/TAGS/tag_hn.asp' and all it returned was:

Linked urls:
/favicon.ico
/stdtheme.css
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.

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