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

package XMLBench;

import java.io.*;
import java.util.*;
import com.exploringxml.xml.*;  // Xparse-J 1.1

/**
 *
 * @author  Tienshiao Ma
 */
public class XMLBenchXparseJsoap {
    
    /** Creates a new instance of XMLBench */
    public XMLBenchXparseJsoap() {
    }
        
    private static void testXparseJ(String s) {
        com.exploringxml.xml.Node root = new Xparse().parse(s);
    }
            
    public static void runTests(String testString) {
        int iterations = 5000;
        long start;
        long stop;
        
        System.out.println("Test String is " + testString.length() + " chars.");
        
        testXparseJ(testString);
        System.out.println("TestXparseJ start ...");
        System.gc();
        start = System.currentTimeMillis();
        for (int i = 0; i < iterations; i++) {
            testXparseJ(testString);
        }
        stop = System.currentTimeMillis();
        System.out.println("... TestXparseJ end: " + (stop - start));
        
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // SOAP example
        runTests("<SOAP-ENV:Envelope\n" +
                 "  xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"\n" +
                 "  SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n" +
                 "   <SOAP-ENV:Header>\n" +
                 "       <t:Transaction\n" +
                 "         xmlns:t=\"some-URI\"\n" +
                 "         xsi:type=\"xsd:int\" mustUnderstand=\"1\">\n" +
                 "           5\n" +
                 "       </t:Transaction>\n" +
                 "   </SOAP-ENV:Header>\n" +
                 "   <SOAP-ENV:Body>\n" +
                 "       <m:GetLastTradePriceResponse\n" +
                 "         xmlns:m=\"Some-URI\">\n" +
                 "           <Price>34.5</Price>\n" +
                 "       </m:GetLastTradePriceResponse>\n" +
                 "   </SOAP-ENV:Body>\n" +
                 "</SOAP-ENV:Envelope>\n");


    }

}
