/*
 * XMLBench.java
 *
 * Created on February 20, 2003, 7:09 PM
 */

package XMLBench;

import java.io.*;
import java.util.*;
import com.alsutton.xmlparser.*;
import com.alsutton.xmlparser.objectmodel.*;

/**
 *
 * @author  Tienshiao Ma
 */
public class XMLBenchAlSuttonsdeep {
    
    /** Creates a new instance of XMLBench */
    public XMLBenchAlSuttonsdeep() {
    }
        
    private static void testAlSuttons(String s) throws IOException {
        ByteArrayInputStream bin = 
            new ByteArrayInputStream(s.getBytes());        
        TreeBuilder tb = new TreeBuilder();
        com.alsutton.xmlparser.objectmodel.Node xmlModel = tb.createTree(new InputStreamReader(bin));
    }
        
    public static void runTests(String testString) throws IOException {
        int iterations = 5000;
        long start;
        long stop;
        
        System.out.println("Test String is " + testString.length() + " chars.");
                
        testAlSuttons(testString);
        System.out.println("TestAlSuttons start ...");
        System.gc();  
        start = System.currentTimeMillis();
        for (int i = 0; i < iterations; i++) {
            testAlSuttons(testString);
        }
        stop = System.currentTimeMillis();
        System.out.println("... TestAlSuttons end: " + (stop - start));
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {

        // deep example
        runTests("<sometag depth=\"0\">\n" +
                 "  <sometag depth=\"1\">\n" +
                 "    <sometag depth=\"2\">\n" +
                 "      <sometag depth=\"3\">\n" +
                 "        <sometag depth=\"4\">\n" +
                 "          <sometag depth=\"5\">\n" +
                 "            <sometag depth=\"6\">\n" +
                 "              <sometag depth=\"7\">\n" +
                 "                <sometag depth=\"8\">\n" +
                 "                  <sometag depth=\"9\">\n" +
                 "                    <sometag depth=\"10\">\n" +
                 "                      No more\n" +
                 "                    </sometag>\n" +
                 "                  </sometag>\n" +
                 "                </sometag>\n" +
                 "              </sometag>\n" +
                 "            </sometag>\n" +
                 "          </sometag>\n" +
                 "        </sometag>\n" +
                 "      </sometag>\n" +
                 "    </sometag>\n" +
                 "  </sometag>\n" +
                 "</sometag>\n");
        

    }

}
