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 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark ""Merging" XML files" Watch ""Merging" XML files" New topic

"Merging" XML files

Dave Edds

Joined: Oct 14, 2004
Posts: 13

I am relatively new to XML / XSL and have a question regarding how I can insert some XML into another XML file.

I have an automated daily build process, using ANT, which invokes JUnit to produce a set of results. I then run an XSLT transform over the results to produce an XML file (Summary.XML) of summary information. This process works fine.

I want to create a History XML file of the results for all days. So I would like to add the information from my Summary.XML file to the end of my History.XML file. In this way I can build up a single XML file of all of the results, which I can graph, chart, do whatever with.

But I cannot append the contents of Summary.XML to the end of History.XML since this would create invalid XML. Is there a way in my XSL transfrom to insert the produced XML to the end of an existing XML file?

I'm really not sure what the best approach is to achieve what I want, so any help or advice would be greatly appreciated.

Thanks in advance,
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12982
I had a similar problem with merging chunks of XML from online surveys. I ended up writing a general purpose XML chunk merging utility routine described in this article. You can download the source from my web site at
I agree. Here's the link:
subject: "Merging" XML files
It's not a secret anymore!