Hi Dan, I've sent a reply to Francois that discusses this approach, and both how you implement it easily and why you might not want to (in particular, the fact that the result would not be valid XML and could not be read in directly by any XML parser).
But for your requirement there's a cleaner solution that doesn't involve too much work, which is to use a "fake" collection for the container object. The <collection> binding element allows you to provide access to the collection in several ways, including by supplying an iter-method that returns an iterator or the combination of a size-method and a load-method (see the <collection> element documentation for details). So you just need to create a class that's able to load the objects on demand, and provide an iterator or indexed access to the objects for JiBX to use when marshalling. This collection facade class can then load one object at a time, and discard the object when done. - Dennis Dennis M. Sosnoski SOA and Web Services in Java Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117 Dan Shuhler wrote: > Hi, > > Is it possible to use JiBX to marshal more than one object into a single > XML file? I have a large quantity of objects I need to marshal. Currently, > I am putting them all into a container object and marshalling that, but > loading so many objects at once puts a heavy strain on the system. I would > prefer to load an object, marshal that data, load the next object, marshal > that data, etc. > > I have not been able to find a way to marshal an object without have an XML > header printed at the top and my output stream being closed. Is there > something I am missing? Or is JiBX not intended for this? > > Thanks for your help, > Dan > > > --------------------------------- > Pinpoint customers who are looking for what you sell. > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > ------------------------------------------------------------------------ > > _______________________________________________ > jibx-users mailing list > jibx-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jibx-users > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users