Convert HtmlParser to use switch instead of giant if-else.