Hi everyone.
I`m developing a Java Xml application and I`m testing different Java XML
parser. I`ve tested the Oracle XML Parser (fastest so far, but uses a lot of
memory) and Suns jaxp (slower, but parses big files fastest) and I`m of
course also testing the Xerces-J parser (I`ve followed the project since
December), but I�ve encountered a major problem when parsing
(non-validating) a 9 MB file, the parsing is incredibly slow (995562 ms),
which is clearly unacceptable for any application in terms of response time.
I`ve used the following code and it runs in a Jdk1.2.2 (using HotSpot 1.0.1)
under Window 2000 Server Edition:
//XercesTest.java
import org.w3c.dom.*;
import org.apache.xerces.parsers.*;
import org.xml.sax.InputSource;
import java.io.*;
import java.net.*;
public class XercesTest extends Object
{
static public void main(String[] argv)
{
long now, after, usedtime;
try{
InputSource biginput = new InputSource(new
FileInputStream("C:\\kurs.xml"));
DOMParser parser = new DOMParser();
parser.setValidating(false);
now = System.currentTimeMillis();
parser.parse(biginput);
after = System.currentTimeMillis();
usedtime = after-now;
System.out.println("Kurs.xml: "+usedtime);
parser.reset();
}catch( Exception e )
{
e.printStackTrace();
}
}
}
I don`t know if I`m doing something wrong or if this is a bug...
Mikael Helbo Kj�r
Software Developer @ DIA a/s