Announcement Announcement Module
Collapse
No announcement yet.
Write Multiple Data Types to One XML file Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Write Multiple Data Types to One XML file

    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.

    <data>
    <categories>
    <category></category>
    <category></category>
    <category></category>
    <categories>
    <products>
    <product></product>
    <product></product>
    <product></product>
    </products>
    </data>

    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?

    My search for a solution hasn't turned up anything so far.
    Last edited by supdeva; Sep 22nd, 2012, 03:58 AM.

  • #2
    Looks like I missed something. Am I trying to do this the wrong way? or is there actually no solution for this?

    Comment

    Working...
    X