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
For this kind of work I will suggest not to use DOM, reading the file content and making a substring is simpler and enough.
I'm thinking of something like that :
String rootContent = document.substring(document.indexOf(""), document.lastIndexOf(" ")+7);
Then to avoid to much memory consummation. Write in the main file after every xml extraction with a BufferedWritter
for example. For better performance you can also use java.nio.