Carey Brown wrote:Your best bet is to process the XML in a serial fashion, in that way you have no memory problems. You could use either the STAX or SAX libraries for this.
Secondly, you are keeping 4 copies of the data in memory: sbfContent(twice), result, and sbfValidatedContent.
sbfContent should be emptied before trying to append to it again.
result and sbfValidatedContent should be released before trying to re-read the file.
Thanks for the pointer Carey.
I was going through the
webpage but it seems STAX API allows to stream XML data. As my input is not a XML file but rather multiple XMLs concatenated together, I am not sure if I can use this. Please correct me if I am wrong.
Also, regarding the duplicacy of data in memory: I will remove the duplicacy but the code fails prior to reaching the duplicated content (i.e. sbfValidatedContent etc.)