Foster, Richard - PAL wrote:

Hi there,

I have a fairly large number of XML files (actually Ncover output files) that I would like to merge into a single file. This will allow me to produce coverage reports for a set of independently built assemblies.

What is the best way to accomplish this in Nant (or is it even appropriate to use Nant - should I be "exec"ing something else)?

My experience has been that NCover output files can be huge, and that processing them with the NAnt <style> task can be very slow, depending upon what you're trying to do. Obviously you can just concatenate them all, stripping out the xml version and stylesheet lines, and wrap with your own new document element. In other words, something like
  cp myHeader.xml > outfile.xml
  grep -v "<?" Coverage.*.xml >> outfile.xml
  cp myFooter.xml >>outfile.xml

where myHeader.xml contains the <?xml, <?xml-stylesheet, and <myTopLevelElement> and myFooter.xml would contain </myTopLevelElement>. This is probably doable in pure NAnt using the copy task with a filter, but it's faster and easier to use write with bash (at least for me). It assumes that the lines with <? don't contain anything else, so that it's safe to remove them on a line by line basis, which is much faster than doing xml parsing.

But is that really what you want for the end result? My experience with large NCover files is that they're a pain to download in the browser, at least using one of the NCover style sheets off the net and Firefox. It may make much more sense to extract the summary data you want from all of the files, and then leave the raw data in separate files. That way anyone who wants to drill down into a specific module won't be dragged down by all the data from other modules.

Gary




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Nant-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to