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

package XMLBench;

import java.io.*;
import java.util.*;
import nanoxml.*;               // nanoxml (modified for j2me)

/**
 *
 * @author  Tienshiao Ma
 */
public class XMLBenchNanoXMLsmall {
    
    /** Creates a new instance of XMLBench */
    public XMLBenchNanoXMLsmall() {
    }
    
    private static void testNanoXML(String s) throws IOException {
        ByteArrayInputStream bin = 
            new ByteArrayInputStream(s.getBytes());
        kXMLElement root = new kXMLElement();
        root.parseFromReader(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.");
                
        testNanoXML(testString);
        System.out.println("TestNanoXML start ...");
        System.gc();
        start = System.currentTimeMillis();
        for (int i = 0; i < iterations; i++) {
            testNanoXML(testString);
        }
        stop = System.currentTimeMillis();
        System.out.println("... TestNanoXML end: " + (stop - start));

    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        // simple example
        runTests("<b>Hello World</b>");
        

    }

}
