File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Concatenating XML Docs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Concatenating XML Docs" Watch "Concatenating XML Docs" New topic

Concatenating XML Docs

Med Shabe
Ranch Hand

Joined: May 08, 2001
Posts: 84
I need suggestions for concatenating XML documents.
Would it be wiser to save the streams to files and then concatenate the needed elements using SAX or just do it with DOM? Considering that the size of each doc. could get 50+K, and also XSL will be applied to the final doc.
Snippets would greatly be appreciated.
[ April 15, 2003: Message edited by: Med Shabe ]
Tina Desai
Ranch Hand

Joined: Mar 13, 2003
Posts: 365
Youcan do what is called a two stage tranformation. Write one xsl to merge the two xml files and then to that xml file apply your final xsl.
Check the document() function for this.

Alongwith being a good coder, try to be a good professional as well!
Med Shabe
Ranch Hand

Joined: May 08, 2001
Posts: 84
Thanks for the pointer.
I checked the document() function and all the samples deal with merging physical files. Any way to merge docs in memory, without saving to file?
Thanks much.
I agree. Here's the link:
subject: Concatenating XML Docs
It's not a secret anymore!