private void addPackages(CoberturaData data, Document doc, Element packages) {
        for (String path : data.getPackageMap().keySet()) {
            Element packageElement = doc.createElement("package");
            packages.appendChild(packageElement);
            packageElement.setAttribute("name", path);
            Set<? extends Coverable> files = data.getPackageMap().get(path);
            SummaryData summaryPackage = new SummaryData(files);
            packageElement.setAttribute("line-rate", "" + summaryPackage.getLineCoverRate());
            packageElement.setAttribute("branch-rate", "" + summaryPackage.getBranchRate());
            packageElement.setAttribute("complexity", "0");

            Element classesElement = doc.createElement("classes");
            packageElement.appendChild(classesElement);

            addClasses(doc, files, classesElement);
        }
    }