-
Dec 2nd, 2010, 08:38 AM
#1
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
-
Dec 13th, 2010, 06:49 AM
#2
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!
-
Dec 15th, 2010, 08:11 AM
#3
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
-
Forum Rules