What is the best way for me to merge two xml strings in java?
-
What do you mean by "merge"? Concatenate one at the end of the other? Or something else?Jim Garrison– Jim Garrison2010-07-08 21:54:06 +00:00Commented Jul 8, 2010 at 21:54
-
see also stackoverflow.com/questions/648471/merge-two-xml-files-in-javak3b– k3b2016-07-19 08:38:29 +00:00Commented Jul 19, 2016 at 8:38
Add a comment
|
2 Answers
Depends on what you mean by "merge" - if you just need them to become a single document, erickson's solution will work. If you need to blend them together in order to to combine matching tags, etc., you're going to have to start by parsing them into Documents, then combining the parts you care about into a new Document, then writing THAT out as XML.