def report(self, morfs, outfile=None):
<EOL>outfile = outfile or sys.stdout<EOL>impl = xml.dom.minidom.getDOMImplementation()<EOL>docType = impl.createDocumentType(<EOL>"<STR_LIT>", None,<EOL>"<STR_LIT>"<EOL>)<EOL>self.xml_out = impl.createDocument(None, "<STR_LIT>", docType)<EOL>xcoverage = self.xml_out.documentElement<EOL>xcoverage.setAttribute("<STR_LIT:version>", __version__)<EOL>xcoverage.setAttribute("<STR_LIT>", str(int(time.time()*<NUM_LIT:1000>)))<EOL>xcoverage.appendChild(self.xml_out.createComment(<EOL>"<STR_LIT>" % __url__<EOL>))<EOL>xpackages = self.xml_out.createElement("<STR_LIT>")<EOL>xcoverage.appendChild(xpackages)<EOL>self.packages = {}<EOL>self.report_files(self.xml_file, morfs)<EOL>lnum_tot, lhits_tot = <NUM_LIT:0>, <NUM_LIT:0><EOL>bnum_tot, bhits_tot = <NUM_LIT:0>, <NUM_LIT:0><EOL>for pkg_name in sorted(self.packages.keys()):<EOL><INDENT>pkg_data = self.packages[pkg_name]<EOL>class_elts, lhits, lnum, bhits, bnum = pkg_data<EOL>xpackage = self.xml_out.createElement("<STR_LIT>")<EOL>xpackages.appendChild(xpackage)<EOL>xclasses = self.xml_out.createElement("<STR_LIT>")<EOL>xpackage.appendChild(xclasses)<EOL>for class_name in sorted(class_elts.keys()):<EOL><INDENT>xclasses.appendChild(class_elts[class_name])<EOL><DEDENT>xpackage.setAttribute("<STR_LIT:name>", pkg_name.replace(os.sep, '<STR_LIT:.>'))<EOL>xpackage.setAttribute("<STR_LIT>", rate(lhits, lnum))<EOL>xpackage.setAttribute("<STR_LIT>", rate(bhits, bnum))<EOL>xpackage.setAttribute("<STR_LIT>", "<STR_LIT:0>")<EOL>lnum_tot += lnum<EOL>lhits_tot += lhits<EOL>bnum_tot += bnum<EOL>bhits_tot += bhits<EOL><DEDENT>xcoverage.setAttribute("<STR_LIT>", rate(lhits_tot, lnum_tot))<EOL>xcoverage.setAttribute("<STR_LIT>", rate(bhits_tot, bnum_tot))<EOL>outfile.write(self.xml_out.toprettyxml())<EOL>denom = lnum_tot + bnum_tot<EOL>if denom == <NUM_LIT:0>:<EOL><INDENT>pct = <NUM_LIT:0.0><EOL><DEDENT>else:<EOL><INDENT>pct = <NUM_LIT> * (lhits_tot + bhits_tot) / denom<EOL><DEDENT>return pct<EOL>
Generate a Cobertura-compatible XML report for `morfs`.

        `morfs` is a list of modules or filenames.

        `outfile` is a file object to write the XML to.