This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
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:
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