A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
XML and Related Technologies
How to avoid overwrite in the XML while marshal mentioned inside of for loop
Joined: Mar 18, 2013
Jun 18, 2013 05:35:56
I am trying to marshal
object into XML. i want to marshal java object into XML while it inside the for loop.
for the above code it's overwriting in the XML file after completion of each loop . but i want to write in new line after completion of each loop. Please let me know , how to do?
Joined: Jul 26, 2007
Jun 18, 2013 05:44:06
Please do take out time to
. I have moved your topic to a more appropriate forum. The original forum you had posted is for questions related to the Ranch
How to ask questions
Donate a pint, save a life!
Onff-turn it on!
Author and all-around good cowpoke
Joined: Mar 22, 2000
Jun 18, 2013 07:30:26
You code does exactly what it says, repeatedly writes to the same file.
Just marshal the whole collection, then you will get the correct XML document root and the members.
I agree. Here's the link:
subject: How to avoid overwrite in the XML while marshal mentioned inside of for loop
how to get xml from java object using JAXB
Java JDBC jtable only displaying one record
readObject from Stream till EOF
how to get XML from javaobject using JAXB
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014