Results 1 to 2 of 2

Thread: Write Multiple Data Types to One XML file

  1. #1
    Join Date
    Jul 2008
    Posts
    25

    Default 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 at 03:58 AM.

  2. #2
    Join Date
    Jul 2008
    Posts
    25

    Default

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •