We have been helping you. Apparently, you are not listening. You cannot do this. It makes no sense. You cannot insert data into the middle of a file, period, ever. That's not what a file is.
Databases, on the other hand, support this kind of operation just fine. Use a database. Insert your data with an INSERT SQL statement. Then when you need your XML (assuming you do need it at all!), use one or more SELECT statements to find the data you need, and construct your XML. Don't use XML to store data you will be adding to. That's just not what it's for. On Tuesday, May 17, 2011 7:57:14 PM UTC-7, SURYA TEJ wrote: > > Dear All , > > is there a alternative way instead of rewriting the entire file ?kindly > help me > > On Tue, May 17, 2011 at 10:53 AM, Bob Kerns <r...@acm.org> wrote: > >> I would use a database for this. Even if it's trivial. >> >> I can't quite figure out the meaning of your XML, or I'd describe the >> schema for you, but it will be pretty simple. (In particular, the position >> of the Answer element seems strange to me, and the value doesn't seem >> related to the question?) >> >> If you need to communicate the results off the device, then I'd generate >> the XML at that point. Otherwise, I'd keep it in database form. >> >> Then you can insert as many trials as you want, and track the individual >> answers as well, query whether he's gotten a particular answer wrong before, >> and a whole lot of other things, and never have to worry about corrupting >> your data with an incomplete write, or coordinating between new and old >> versions of files in a way that doesn't break if you turn off the device in >> the middle of an operation. >> >> XML is great for communicating between programs, or recording final >> results. As you are finding out, it's not so great for storing intermediate >> data. >> >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to android-d...@googlegroups.com >> To unsubscribe from this group, send email to >> android-develop...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en >> > > > > -- > Thanks & Regards, > > Suryatej, > 9247714040. > > > Please Save paper, Save trees. > Please don't print this email and documents unless it is really necessary. > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en