Correctly ignore case sensitivity for doctype declaration when checking for valid doctype