determining type of tag

Topics: Developer Forum, User Forum
Dec 20, 2007 at 9:32 PM
I'm new to the Agility Pack, so I may just be overlooking something, but I'm having a problem determining the tag name of an HtmlNode. In other words, given an HtmlNode, how do I find out if it's a <p> or <img> or <table>, etc.

Anyone been able to do this? Is this functionality built-in somewhere and I'm just missing it?
Jan 7, 2008 at 8:16 PM

SaintJimmy wrote:
I'm new to the Agility Pack, so I may just be overlooking something, but I'm having a problem determining the tag name of an HtmlNode. In other words, given an HtmlNode, how do I find out if it's a <p> or <img> or <table>, etc.

Anyone been able to do this? Is this functionality built-in somewhere and I'm just missing it?


Look at the HtmlNode.Name property - that contains the node type. HtmlAgilityPack has no knowledge of node types, no enumeration of node types, or anything. Specific node types are handled specially in a couple of places, and that is it (like forms).