On 12 May 2006 05:03:05 -0700,
wrote:
> I am new to JDOM and I am currently coding a program to build xml
>files using JDOM.
> The size of the xml file which i am goin to build will be in the order
>of a few GB's( 1 to 5 GB).
> Will I be able to build such huge documents with JDOM??
> Also if there are any resources on jdom benchmarking please let me
>know the links.
At a time, I found a few JDOM benchmarks, mostly bechmarking speed.
JDOM scored pretty well compared to purely SAX tools, it is one of the
fastest.
As for the maximum size of an XML file... why not test it yourself?
I've just run this simple test case:
import org.jdom.Document;
import org.jdom.Element;
public class JDOM {
// Timeout set to 60 seconds
private static long timeout = 60 * 1000;
public static void main(String[] args) {
Element element = new Element("root");
Document document = new Document(element);
long i = 1;
long startTime = System.currentTimeMillis();
try {
for (;; i++) {
Element currElement = new Element("element" +
String.valueOf(i));
element.addContent(currElement);
element = currElement;
if (System.currentTimeMillis() - startTime > timeout){
break;
}
}
} catch (Exception ex) {
System.out.println("Exception: " + ex.getMessage());
}
System.out.println("Number of created elements: " + i);
}
}
It was able to create 28885 elements in 60 seconds. I left it running
for a while without a timeout, to see if it would throw
OutOfMemoryException, but it seems that the memory overhead for
element is pretty low, so it would take forever to drain the heap.
Domchi
--
Ouroboros ltd. -
http://www.ouroboros.hr
Antispam: to reply, remove extra monkey from reply-to address.