I have a dig around Antoine, as I also use SONAR and Cobertura in my projects and am intrigued by your problem. From what I see, when you tell the ANT task to generate "html" as output, you get all the information you need about the strings, but, as you pointed out, this is not an easily parsed format (and maybe can be changed).
With SONAR, I tell Cobertura to output "xml", which gives me a file called coverage.xml with the output. Unfortunately, it does not include linear data, and I do not see any ANT parameters to include them from Cobertura docs.
It seems to me that a file named cobertura.ser contains all the required data, but only an HTML report is displayed for it. I believe the answer to your question may be to try to extract the required serialized data from cobertura.ser.
Looking at the source code, I see the following classes
net.sourceforge.cobertura.reporting.html.HTMLReport net.sourceforge.cobertura.reporting.xml.XMLReport
What I suspect you can try and do is take a copy of HTMLReport as a base and try to write the same output as XML, which you can then parse for your own purposes (or mjust ad - the same method calls that are used HTMLReport in XMLReport). I can see the nbHitsUncovered string in HTMLReport , so hopefully you only have one class to write to.
I googled around and don't see anyone do this, but it looks like a useful improvement.
source share