Can JAXB Incrementally Marshall An Object?
        Posted  
        
            by Intellectual Tortoise
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Intellectual Tortoise
        
        
        
        Published on 2010-04-08T19:16:44Z
        Indexed on 
            2010/04/08
            19:23 UTC
        
        
        Read the original article
        Hit count: 548
        
jaxb
|marshalling
I've got a fairly simple, but potentially large structure to serialize. Basically the structure of the XML will be:
<simple_wrapper>
   <main_object_type>
     <sub_objects>
   </main_object_type>
     ... main_object_type repeats up to 5,000 times
</simple_wrapper>
The main_object_type can have a significant amount of data.  On my first 3,500 record extract, I had to give the JVM way more memory than it should need.
So, I'd like to write out to disk after each (or a bunch of) main_object_type.
I know that setting Marshaller.JAXB_FRAGMENT would allow it fragments, but I loose the outer xml document tags and the <simple_wrapper>.
Any suggestions?
© Stack Overflow or respective owner