This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Write Multiple Data Types to One XML file

Sep 22nd, 2012, 03:54 AM

I need to read objects from 2 different tables and write to a single XML file. I am using org.springframework.batch.item.database.HibernateC ursorItemReader to read from the database and javax.xml.stream.XMLEventWriter.StaxEventItemWrite r to write the XML. The structure I am trying to achieve looks like this.

Categories and products come from 2 different database tables. I was thinking of doing this in two steps. First write categories then write products. However, looks like the StaxEventItemWriter doesn't allow any appending. Is there a solution to this other than doing a separate merge step as suggested in http://forum.springsource.org/showth...ting-to-1-file ? Can we have multiple readers and a single marshaller?