public static void main(String[] args) throws SAXException, IOException,
            ParserConfigurationException {
        long duration = Long.parseLong(args[1]) * 60000L;
        String path = args[2];
        
        char[] testData = loadFileIntoArray(new File(path));
        
        XmlSerializer ch = new XmlSerializer(new NullWriter());
        
        XMLReader reader = null;
        if ("h".equals(args[0])) {
            HtmlParser parser = new HtmlParser(XmlViolationPolicy.ALLOW);
            parser.setContentHandler(ch);
            parser.setStreamabilityViolationPolicy(XmlViolationPolicy.FATAL);
            reader = parser;
        } else if ("t".equals(args[0])) {
            Driver driver = new Driver(new TokensToSax(ch));
            driver.setContentNonXmlCharPolicy(XmlViolationPolicy.ALLOW);
            driver.setContentSpacePolicy(XmlViolationPolicy.ALLOW);
            driver.setNamePolicy(XmlViolationPolicy.ALLOW);
            driver.setXmlnsPolicy(XmlViolationPolicy.ALLOW);
            reader = new DriverWrapper(driver);
        } else if ("a".equals(args[0])) {
            reader = new SAXDriver();
            reader.setFeature("http://xml.org/sax/features/namespaces", true);
            reader.setFeature("http://xml.org/sax/features/validation", false);
            reader.setFeature("http://xml.org/sax/features/string-interning", true);
            reader.setFeature("http://xml.org/sax/features/external-general-entities", false);
            reader.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
            reader.setContentHandler(ch);
            reader.setEntityResolver(new NullEntityResolver());
       } else if ("n".equals(args[0])) {
            System.out.println(Version.getVersion());
            reader = new SAXParser();
            reader.setFeature("http://xml.org/sax/features/namespaces", false);
            reader.setFeature("http://xml.org/sax/features/validation", false);
            reader.setFeature("http://xml.org/sax/features/string-interning", true);
            reader.setFeature("http://xml.org/sax/features/external-general-entities", false);
            reader.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
            reader.setContentHandler(ch);
            reader.setEntityResolver(new NullEntityResolver());
        } else {
            System.out.println(Version.getVersion());
            reader = new SAXParser();
            reader.setFeature("http://xml.org/sax/features/namespaces", true);
            reader.setFeature("http://xml.org/sax/features/validation", false);
            reader.setFeature("http://xml.org/sax/features/string-interning", true);
            reader.setFeature("http://xml.org/sax/features/external-general-entities", false);
            reader.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
            reader.setContentHandler(ch);
            reader.setEntityResolver(new NullEntityResolver());            
        }
        System.out.println("Warmup:");
        System.out.println((new ParserPerfHarnessNew(System.currentTimeMillis()
                + duration, reader, testData)).runLoop());
        System.gc();
        System.out.println("Real:");
        System.out.println((new ParserPerfHarnessNew(System.currentTimeMillis()
                + duration, reader, testData)).runLoop());
    }
@param args
@throws IOException
@throws SAXException
@throws ParserConfigurationException
resources/examples/research-src/nu/validator/perftest/ParserPerfHarnessNew.java