开发者

Jaxb to generate the XML directly to the OutputStream

I have a 500Mb csv file. I need to convert it into XML file.

I am using the Jaxb to created the xml file. It is working fine for small amout of data.

but for large amout of data like 300 mb it is throwing out of memory exception.

Can anyone tell me that How can I create each开发者_如何转开发 element and write it into a file

without creating the whole tree using the jaxb?"

Thanks Sonu


Converting csv to XML you should expect the size of data to be about 10x larger. I suggest you increase the heap size to 10 Gb if you want to use Jaxb for your whole file at once, possibly higher.

Another approach would be to convert one line of CSV at a time. You can still use Jaxb to do this, but you may find a one line println statement is much simpler. In this case, you can expect your program will use up to 10x the longest line. (Which might be a few KB)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜