File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Compariosn between different Java Object XML Binding Framework Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Compariosn between different Java Object XML Binding Framework" Watch "Compariosn between different Java Object XML Binding Framework" New topic

Compariosn between different Java Object XML Binding Framework

Amit Arora
Ranch Hand

Joined: Jun 14, 2007
Posts: 30
I have to generate the classes from schema (XSD). Then I have to unmarhsall the XML into objects and then marshall the objects to XML.
I have looked for various framework supporting that. I have looked for JAXB, Castor, XMLBeans, JIBX, Quick and Zeus.
The finding are as:

1. Quick and Zeus does not support the class generation from XSD, only supports class generation from DTD.
2. JIBX does not support class generation from schema having enumeration or restriction tag.
3. JAXB supports generation of classes but could not unmarshall the XML (provided to me, although it supports unmarshalling from other XMLs), as XSD have only complex types, so could not generate the classes corresponding to the root element. So failed due to the binding problem with the XML provided to me.
4. Castor and XMLBeans are working fine. I am confused to use which of the approach. The problem is with the memory. I have run a lot of tests and have found that performance of XMLBeans is far better compared to Castor, but for larger XML (>20MB) the castor works fine but XMLBeans throws OutOfMemory Error. The observations are:

Memory| Castor | XMLBeans
10MB | 10 sec | 3 sec
22MB | 16 sec | Failed
32MB | 18 sec | Failed
42MB | Failed | Failed

The size of XML could be large, could anyone suggests how to improve the performance of castor or how could XMLBeans supports the much bigger XML? The heap memory allocated is 256MB and that is fixed.

Amit Arora<br />SCJP 1.4, SCWCD
Ben Two
Ranch Hand

Joined: Jul 06, 2007
Posts: 35
Hi, I prefer XMLBeans in your case. But I did not test it with large xml files. For me it's always advisable to avoid large xml. Maybe you can research your xml schema again and try to reduce the xml file size?

Since xml file is designed not only for storage, but also for read. It's not a good idea to use a xml file larger then 20M

I agree. Here's the link:
subject: Compariosn between different Java Object XML Binding Framework
It's not a secret anymore!