I need to generate a big xml. I am currently using JAXB 2.0 .
The problem is if I keep all the objects in memory and generate the probability of running out of heap space is very high.
I would like to know the best approach on how to do this.
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use StAX to marshal the outer body of the XML, and then use JAXB to marshal the repeated objects without having to have them all in memory.
See this thread: http://glassfish.10926.n7.nabble.com/Marshalling-Large-data-into-xml-td55636.html