Re: [android-developers] Re: Appending nodes to an existing XML file

2011-05-18 Thread Bob Kerns
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

[android-developers] Re: Appending nodes to an existing XML file

2011-05-18 Thread Zsolt Vasvari
And imagine, this guy probably took the job of 2 US engineers... On May 18, 2:38 pm, Bob Kerns r...@acm.org wrote: 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

Re: [android-developers] Re: Appending nodes to an existing XML file

2011-05-17 Thread surya tej
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

[android-developers] Re: Appending nodes to an existing XML file

2011-05-17 Thread DanH
Well, you can just ask the user to remember his scores. Or you can use a database. Or you can write some other sort of file. [Please help save electrons -- don't read this post unless absolutely necessary.] On May 17, 9:57 pm, surya tej akkirajusurya...@gmail.com wrote: Dear All , is there

Re: [android-developers] Re: Appending nodes to an existing XML file

2011-05-16 Thread surya tej
Thanks a lot folks..for your response My XML format is .. Test attempt /attempt QuestionSet Question type = 1 path=images/a.jpg Options type = 1 value =1 /options Options type = 1 value =2 /options Options type = 1 value =3 /options

[android-developers] Re: Appending nodes to an existing XML file

2011-05-16 Thread DanH
You're not appending, you're inserting. You basically will need to read/write the entire file. On May 16, 1:07 pm, surya tej akkirajusurya...@gmail.com wrote: Thanks a lot folks..for your response My XML format is .. Test

Re: [android-developers] Re: Appending nodes to an existing XML file

2011-05-16 Thread Bob Kerns
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

[android-developers] Re: Appending nodes to an existing XML file

2011-05-15 Thread lbendlin
Throw away your requirement (no rewriting of the file) and you have a simple solution. -- 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,

[android-developers] Re: Appending nodes to an existing XML file

2011-05-15 Thread Bob Kerns
Simple, yes, but it performs as O(n^2). As your file gets longer and longer, your application will perform slower and slower. If you don't take care to do it off the UI thread, you will eventually start getting force-closes because it stalls out the UI thread. Not generally recommended. All

[android-developers] Re: Appending nodes to an existing XML file

2011-05-15 Thread DanH
Another alternative is a journaled approach. Write the updates to a journal, then merge them with the main file from time to time in a batch processing step. On May 15, 4:57 pm, Bob Kerns r...@acm.org wrote: Simple, yes, but it performs as O(n^2). As your file gets longer and longer, your

Re: [android-developers] Re: Appending nodes to an existing XML file

2011-05-15 Thread Miguel Morales
Hmm, I'd probably do it one of two ways depending on how big the xml file is expected to grow. If it's relatively small, read it into memory, deserialize it, find the node/tag where you wish to append your node, append it and then re-serialize it into the same file. But that's only if it's

[android-developers] Re: Appending nodes to an existing XML file

2011-05-14 Thread Zsolt Vasvari
It would be great if you can give the entire source code. Of course, why don't you just send us your Requirements Docs and will send you back the entire app for you. Free of charge, of course. -- You received this message because you are subscribed to the Google Groups Android Developers

[android-developers] Re: Appending nodes to an existing XML file

2011-05-14 Thread DanH
Can't be done. (Well, could be done, but would require some file calisthenics. You'd need to scan through the file to find the closing tag, figure out what record that begins with -- it might actually span records -- then write your new tags in place of the closing tag and restore the closing

[android-developers] Re: Appending nodes to an existing XML file

2011-05-14 Thread Bob Kerns
Well, there IS one way, sort of. You can have one XML file that has the outer tags, with a DTD that defines and entity that references a second file that contains a sequence of XML forms, and a reference to that entity between the outer tags. The need for two files is often reason enough to