HtmlAgilityPack kind of sucks IMO. They made some really wonky design decisions.
- When using
SelectNodes
, if no nodes are found, it returnsnull
rather than an empty set, so you can't justforeach
over it without a null check. - When trying to select children with
node.SelectNodes
it actually searches from the document root (which I thought was discarded -- why is the node carrying more info than it should?) unless you usedescendant::
which is not obvious nor expected behavior at all, IMO. HtmlDocument.Load
doesn't return the root node, which is what you'd want 99% of the time, I think
You might disagree with that of course, but that's not the point. I'm looking for something different. Something that behaves a little more sane, or something that uses jQuery syntax would be even better. Suggestions?