Which HTML Parser is the best?

I code a lot of parsers. Up until now, I was using HtmlUnit headless browser for parsing and browser automation.
Now, I want to separate both the tasks.

Self plug: I have just released a new Java HTML parser: jsoup. I mention it here because I think it will do what you are after.

Its party trick is a CSS selector syntax to find elements, e.g.:


String html = "First parse"

  + "Parsed HTML into a doc.";

Document doc = Jsoup.parse(html);

Elements links = doc.select("a");

Element head = doc.select("#head").first();

See the Selector javadoc for more info.