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

package XMLBench;

import java.io.*;
import java.util.*;
import org.tienshiao.XMLLite.*;               // My XML Parser

/**
 *
 * @author  Tienshiao Ma
 */
public class XMLBenchXMLLsmall {
    
    /** Creates a new instance of XMLBench */
    public XMLBenchXMLLsmall() {
    }
        
    private static void testMyXML(String s) throws IOException, XMLParserException {
        ByteArrayInputStream bin = 
            new ByteArrayInputStream(s.getBytes());
        XMLElement test = new XMLElement();
        test.parseFromReader(new InputStreamReader(bin));
    }
            
    public static void runTests(String testString) throws IOException, XMLParserException {
        int iterations = 5000;
        long start;
        long stop;
        
        System.out.println("Test String is " + testString.length() + " chars.");
                
        testMyXML(testString);
        System.out.println("TestMyXML start ...");
        System.gc();
        start = System.currentTimeMillis();
        for (int i = 0; i < iterations; i++) {
            testMyXML(testString);
        }
        stop = System.currentTimeMillis();
        System.out.println("... TestMyXML end: " + (stop - start));
        
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException, XMLParserException {
        // simple example
        runTests("<b>Hello World</b>");
        
    }

}
