Results 1 to 3 of 3

Thread: Writing complex type itens into XML File

  1. #1
    Join Date
    Apr 2010
    Location
    Brazil
    Posts
    12

    Default Writing complex type itens into XML File

    Hello,

    I want to write itens with STAX writer into specific element of XML file, according to XSD. For example:

    <root>
    <header></header>
    <itens>
    <!-- I WANT TO WRITE ITENS HERE -->
    <item></item>
    ...
    </itens>
    <footer></footer>
    </root>

    May you help me???

    Thanks
    Fabiano Suet

  2. #2
    Join Date
    Apr 2010
    Location
    Brazil
    Posts
    12

    Default

    Until now, I haven't solved this problem. I have thought if I can solve this using JAXB marshaller instead XStream. I don't know if this works, but I'll try....

    Someone can help me?

    Thanks a lot!

  3. #3
    Join Date
    Apr 2010
    Location
    Brazil
    Posts
    12

    Default

    I found a solution extending StaxEventItemWriter e rewriting the methods open and close. Before write itens, I called createStartElement in open method (if the job is not restarted) to write the necessary start elements where itens will be write inside. After that, I called the createEndElement in close method, before called footerCallback, to write end elements for each start element that wrote before.

    Thank you very much!

Tags for this Thread

Posting Permissions

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