tags:

views:

41

answers:

3

Hello, i have several xmls that are of the same format, and i'd like to join them together into one big xml file. Is there any useful class that would let me grab specific nodes and mix them together, or do i have to parse all of the xmls through and create a new one? regards peter

A: 

If the format is simple and the joins would not be nested deeply,
Why not throw header away, and join the text?

If the join would be more complex apache commons would come with a helping hand.
So parsing would be most reasonable solution though.

bua
+1  A: 

This entirely depends on whet the structures of the XML files represent. You cannot just concatenate them, as then you will have multiple root elements. While you can use SAX parsers to copy contents without loading the whole files in memory, you still need to figure out how to interleave the contents.

Tassos Bassoukos
A: 

You can also use XSLT for doing this. Check this for more details. You can use XSLTransformer API in java.

Tushar Tarkas