public static void main(String[] arg) throws ParseException, IOException {
        ArgParse cliParser = new ArgParse();
        List<String> extras = Args.parse(cliParser, arg);
        if(extras.size() != 1
                || cliParser.isHelp) {
            Args.usage(cliParser);
            System.exit(1);
        }

        final File xmlFile = new File(extras.get(0));

        // XSD prefix
        
        XsdConfig config = new XsdConfig();
        if(cliParser.xsdPrefix != null) {
            config.setXsdPrefix(cliParser.xsdPrefix);
        }
        final XsdGen xsdGen = new XsdGen(config);

        // Charset
        final Charset charset;
        if(cliParser.encoding != null) {
            charset = Charset.forName(cliParser.encoding);
        }
        else {
            charset = Charsets.UTF_8;
        }

        // Output file
        final OutputStream os;
        if(cliParser.xsdFile != null) {
            File outFile = new File(cliParser.xsdFile);
            if(outFile.exists() && !cliParser.isForceWrite) {
                System.err.println("The outfile already exists!");
                System.exit(2);
            }
            os = new FileOutputStream(outFile);
        }
        else {
            os = System.out;
        }

        // Parse & Write!
        xsdGen.parse(xmlFile).write(os, charset);
    }