Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xstream driver performance

Tags:

java

xml

xstream

I am using XStream to convert XML to objects. I am converting large xml. I have encountered below two statements.

XStream xstream = new XStream(new DomDriver());

XStream xstream = new XStream(new StaxDriver());

Since I am using large xml for conversion, which one result better performance? why?

Please help.

like image 819
Java P Avatar asked Aug 10 '12 13:08

Java P


2 Answers

Staxdriver should perform better as it uses pull parser technology which is the fastest technology for parsing xml and uses less memory as document is not loaded in memory as for dom one.

like image 150
UBIK LOAD PACK Avatar answered Sep 16 '22 23:09

UBIK LOAD PACK


The StaxDriver will parse the data progressively so it can be more efficient. It only work with Stax parsers. If you want to use a DOM parser, you need to use the DomParser.

like image 40
Peter Lawrey Avatar answered Sep 20 '22 23:09

Peter Lawrey