In efforts to update make Html Agility Pack's Xpath support to be identical to System.Xml.Xpath I have updated HAP to have HtmlNode and HtmlAttribute implement a base interface. This interface IHtmlBaseNode is now the primary type returned by XPATH operations. Now queries that are trying to just retrieve an HtmlAttribute will do just that. Instead of returning the HtmlNode that includes the attribute. Example, an doc.Document.SelectNodes("//@href") will return a list of HtmlAttribute objects.
This release is Experimental and does introduce some large breaking changes. Thus I'm putting this in an branch for 2.0 labeled as experimental.
- SelectSingleNode returns IHtmlBaseNode
- SelectNodes returns List<IHtmlBaseNode>
- SelectNodes will never return null, if no matching elements are found it will return an empty list
The source code can be found in SVN under branches/2.0.Experimental