Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Compariosn between different Java Object XML Binding Framework

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

regards
Ben
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic