public String Execute(ProjectElement project) { StringBuilder buffer = new StringBuilder(); buffer.Append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); buffer.Append(String.Format("\n<coverage generated=\"{0}\" clover=\"3.0.2\" xmlns=\"http://schemas.atlassian.com/clover3/report\">", project.Timestamp)); buffer.Append(String.Format("\n<project name=\"{0}\" timestamp=\"{1}\">", project.Name, project.Timestamp)); buffer.Append(String.Format("\n {0}", project.Metrics.ToXml())); foreach (PackageElement pe in project.GetPackages()) { buffer.Append(String.Format("\n <package name=\"{0}\">", pe.Name)); buffer.Append(String.Format("\n {0}", pe.Metrics.ToXml())); foreach (FileElement fe in pe.GetFiles()) { buffer.Append(String.Format("\n <file name=\"{0}\" path=\"{1}\">", fe.Name, fe.Path)); buffer.Append(String.Format("\n {0}", fe.Metrics.ToXml())); foreach (ClassElement ce in fe.GetClasses()) { buffer.Append(String.Format("\n <class name=\"{0}\">", ce.Name)); buffer.Append(String.Format("\n {0}", ce.Metrics.ToXml())); buffer.Append("\n </class>"); } foreach (LineElement le in fe.GetLines()) { buffer.Append(String.Format("\n <line num=\"{0}\" count=\"{1}\" type=\"{2}\"", le.Number, le.Coverage, le.Type)); if (le.Signature != null && le.Signature.Length > 0) { buffer.Append(String.Format(" signature=\"{0}\"", le.Signature)); } buffer.Append(" />"); } buffer.Append("\n </file>"); } buffer.Append("\n </package>"); } buffer.Append("</project>"); buffer.Append("</coverage>"); return buffer.ToString(); }