Doctype parsing. Numerous parser refactroings