private static void checkFiles(String[] args, int fileArgsStart)
            throws IOException, Exception, SAXException {
        for (int i = fileArgsStart; i < args.length; i++) {
            if (args[i].startsWith("http://") || args[i].startsWith("https://")) {
                emitFilename(args[i]);
                try {
                    validator.checkHttpURL(args[i], userAgent, errorHandler);
                } catch (IOException e) {
                    if (e.getCause() instanceof //
                            org.apache.http.TruncatedChunkException) {
                        continue;
                    } else if (e.getCause() instanceof //
                            org.apache.http.MalformedChunkCodingException
                            && (e.getMessage().contains(
                                    "CRLF expected at end of chunk"))) {
                        continue;
                    } else if (e.getCause() instanceof //
                            org.apache.http.ConnectionClosedException
                            && (e.getMessage().contains(
                                    "closing chunk expected"))) {
                        continue;
                    }
                    errorHandler.fatalError(new SAXParseException(e.getMessage(),
                            null, args[i], -1, -1,
                            new SystemIdIOException(args[i], e.getMessage())));
                }
            } else {
                File file = new File(args[i]);
                if (file.isDirectory()) {
                    recurseDirectory(file);
                } else if (forceCSS) {
                    checkCssFile(file);
                } else if (skipNonCSS) {
                    if (isCss(file)) {
                        checkCssFile(file);
                    }
                } else if (alsoCheckCSS && isCss(file)) {
                    checkCssFile(file);
                } else if (forceSVG) {
                    checkSvgFile(file);
                } else if (skipNonSVG) {
                    if (isSvg(file)) {
                        checkSvgFile(file);
                    }
                } else if (alsoCheckSVG && isSvg(file)) {
                    checkSvgFile(file);
                } else {
                    checkHtmlFile(file);
                }
            }
        }
    }
Simple command-line validator for HTML/XHTML files.
src/nu/validator/client/SimpleCommandLineValidator.java