阅读背景:

Java XML DOM包含大量数据,我该如何缓冲它?

来源:互联网 

I have a Java program that is generating XML data which happens to be very large. I am using the typical parsers in javax.xml and the org.w3c.dom objects. The DOM in memory is becoming so large that it occasionally runs out of memory. Now, the reason it reaches the memory limit is because the program is generating all of the data at once and then transforming it to a String and then to a file. There are hundreds of elements being generated at once that could be made one at a time and buffered to a file rather than slowly filling the RAM. I've been looking into libraries out there but I'm a bit confused on what is good. What method should I be using to buffer this DOM document to a file rather than generating all at once?I have a Java program that is generating XML da




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: