How to merge >1000 xml files into one using Java

后端 未结 6 1786
予麋鹿
予麋鹿 2021-02-06 06:36

I am trying to merge many xml files into one. I have successfully done that in DOM, but this solution is limited to a few files. When I run it on multiple files >1000 I am getti

6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-06 07:02

    DOM needs to keep the whole document in memory. If you don't need to do any special operation with your tags, I would simply use an InputStream and read all the files. If you need to do some operations, then use SAX.

提交回复
热议问题