@Override
    protected void loadDocAndSetupParser() throws SAXException, IOException, IncorrectSchemaException, SAXNotRecognizedException, SAXNotSupportedException {
        setAllowGenericXml(false);
        setAcceptAllKnownXmlTypes(false);
        setAllowHtml(true);
        setAllowXhtml(true);
        loadDocumentInput();
        String type = documentInput.getType();
        if ("text/html".equals(type) || "text/html-sandboxed".equals(type)) {
            validator = validatorByDoctype(HTML5_SCHEMA);
            usingHtml = true;
            newHtmlParser();
            htmlParser.setDocumentModeHandler(this);
            htmlParser.setContentHandler(validator.getContentHandler());
            reader = htmlParser;
        } else {
            validator = validatorByDoctype(XHTML5_SCHEMA);
            setupXmlParser();
            if (!("application/xhtml+xml".equals(type) || "application/xml".equals(type))) {
                String message = "The preferred Content-Type for XHTML5 is application/xhtml+xml. The Content-Type was " + type + ".";
                SAXParseException spe = new SAXParseException(message, null, documentInput.getSystemId(), -1, -1);
                errorHandler.warning(spe);
            }
        }

    }
@see nu.validator.servlet.VerifierServletTransaction#loadDocAndSetupParser()
src/nu/validator/servlet/Html5ConformanceCheckerTransaction.java