Apply xslt stylesheet to xml logs file and crate an HTML report file.

@param xmlLogsFile
@param htmlReportFile
503806
private void prettyprint(String xmlLogsFile, FileOutputStream htmlReportFile)
            throws Exception {
        TransformerFactory tFactory = TransformerFactory.newInstance();
        // Fortify Mod: prevent external entity injection
        tFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        // Fortify Mod: prevent external entity injection
        factory.setExpandEntityReferences(false);
        factory.setNamespaceAware(true);
        factory.setXIncludeAware(true);
        DocumentBuilder parser = factory.newDocumentBuilder();
        Document document = parser.parse(xmlLogsFile);
        Transformer transformer = tFactory.newTransformer(new StreamSource(
                xsltFileHandler));
        transformer.transform(new DOMSource(document), new StreamResult(
                htmlReportFile));
    }
1113350
public void addChangelogFile(File changelogFile) throws IOException, ChangelogParseException {
		new ChangelogHandler(this.format.getHeader()).addChangeLog(changelogFile);
	}
214932
public void prettyPrintsReport(File sessionDir, File prettyPrintReportFile)
            throws Exception {
        if ((!sessionDir.exists()) || (!sessionDir.isDirectory())) {
            throw new Exception("Error: LOGDIR " + sessionDir.getAbsolutePath()
                    + " seems not a valid directory. ");
        }
        File xml_logs_report_file = new File(sessionDir.getAbsolutePath()
                + File.separator + "report_logs.xml");
        if (!xml_logs_report_file.exists()) {
            // throw new Exception("Error: missing logfile  " +
            // xml_logs_report_file.getAbsolutePath() + " ! ");
            System.out.println("Warning: missing logfile  "
                    + xml_logs_report_file.getAbsolutePath() + " ! ");
            System.out.println("Trying to create it!");
            LogUtils.createFullReportLog(sessionDir.getAbsolutePath());
        }
        File html_output_report_file = prettyPrintReportFile;
        if (html_output_report_file.exists()) {
            System.out.println("Report file \""
                    + html_output_report_file.getAbsolutePath() + "\" reused!");
            return;
        }
        // Fortify Mod: Close the FileOutputStream and releaase its resources
        // prettyprint(xml_logs_report_file.toURI().toURL().toExternalForm(),
        //         new FileOutputStream(html_output_report_file));
        FileOutputStream fos = new FileOutputStream(html_output_report_file);
        prettyprint(xml_logs_report_file.toURI().toURL().toExternalForm(), fos);
        fos.close();
        System.out.println("Report file \""
                + html_output_report_file.getAbsolutePath() + "\" created!");
    }
428013
private static void printAsXML(Rule rule, StringBuilder xmlStringBuilder) {
    if (rule.version != null) {
      xmlStringBuilder.append("  <!-- since " + rule.version + " -->");
      xmlStringBuilder.append(LINE_SEPARATOR);
    }
    xmlStringBuilder.append("  <rule>");
    xmlStringBuilder.append(LINE_SEPARATOR);
    xmlStringBuilder.append("    <key>" + rule.fixedRuleKey() + "</key>");
    xmlStringBuilder.append(LINE_SEPARATOR);
    xmlStringBuilder.append("    <severity>" + rule.severity + "</severity>");
    xmlStringBuilder.append(LINE_SEPARATOR);
    xmlStringBuilder.append("    <name><![CDATA[" + rule.name + "]]></name>");
    xmlStringBuilder.append(LINE_SEPARATOR);
    xmlStringBuilder.append("    <internalKey><![CDATA[" + rule.internalKey + "]]></internalKey>");
    xmlStringBuilder.append(LINE_SEPARATOR);
    xmlStringBuilder.append("    <description><![CDATA[" + rule.description + "]]></description>");
    xmlStringBuilder.append(LINE_SEPARATOR);
    if (!rule.tags.isEmpty()) {
      for (String tag : rule.tags) {
        xmlStringBuilder.append("    <tag>" + tag + "</tag>");
        xmlStringBuilder.append(LINE_SEPARATOR);
      }
    }

    if (!rule.parameters.isEmpty()) {
      List<RuleParameter> sortedParameters = Lists.newArrayList(rule.parameters);
      Collections.sort(sortedParameters, new Comparator<RuleParameter>() {
        @Override
        public int compare(RuleParameter o1, RuleParameter o2) {
          return o1.key.compareTo(o2.key);
        }
      });
      for (RuleParameter parameter : sortedParameters) {
        xmlStringBuilder.append("    <param>");
        xmlStringBuilder.append(LINE_SEPARATOR);
        xmlStringBuilder.append("      <key>" + parameter.key + "</key>");
        xmlStringBuilder.append(LINE_SEPARATOR);
        if (StringUtils.isNotBlank(parameter.description)) {
          xmlStringBuilder.append("      <description><![CDATA[" + parameter.description + "]]></description>");
          xmlStringBuilder.append(LINE_SEPARATOR);
        }
        if (StringUtils.isNotBlank(parameter.defaultValue) && !"null".equals(parameter.defaultValue)) {
          xmlStringBuilder.append("      <defaultValue>" + parameter.defaultValue + "</defaultValue>");
          xmlStringBuilder.append(LINE_SEPARATOR);
        }
        xmlStringBuilder.append("    </param>");
        xmlStringBuilder.append(LINE_SEPARATOR);
      }
    }

    xmlStringBuilder.append("  </rule>");
    xmlStringBuilder.append(LINE_SEPARATOR);
    xmlStringBuilder.append(LINE_SEPARATOR);
  }
274919
public void processSheet(StylesTable styles, ReadOnlySharedStringsTable strings, SheetContentsHandler sheetHandler,
			InputStream sheetInputStream) throws IOException, ParserConfigurationException, SAXException {
		DataFormatter formatter = new DataFormatter();
		InputSource sheetSource = new InputSource(sheetInputStream);
		try {
			XMLReader sheetParser = SAXHelper.newXMLReader();
			ContentHandler handler = new XSSFSheetXMLHandler(styles, null, strings, sheetHandler, formatter, false);
			sheetParser.setContentHandler(handler);
			sheetParser.parse(sheetSource);
		} catch (ParserConfigurationException e) {
			throw new RuntimeException("SAX parser appears to be broken - " + e.getMessage());
		}
	}
1305545
public void generateReport(List<XmlSuite> xmlSuites,
                               List<ISuite> suites,
                               String outputDirectoryName)
    {
        removeEmptyDirectories(new File(outputDirectoryName));
        
        boolean useFrames = System.getProperty(FRAMES_PROPERTY, "true").equals("true");
        boolean onlyFailures = System.getProperty(ONLY_FAILURES_PROPERTY, "false").equals("true");

        File outputDirectory = new File(outputDirectoryName, REPORT_DIRECTORY);
        outputDirectory.mkdirs();

        try
        {
            if (useFrames)
            {
                createFrameset(outputDirectory);
            }
            createOverview(suites, outputDirectory, !useFrames, onlyFailures);
            createSuiteList(suites, outputDirectory, onlyFailures);
            createGroups(suites, outputDirectory);
            createResults(suites, outputDirectory, onlyFailures);
            createLog(outputDirectory, onlyFailures);
            copyResources(outputDirectory);
        }
        catch (Exception ex)
        {
            throw new ReportNGException("Failed generating HTML report.", ex);
        }
    }
1013881
public static void writeXML(Document xmldocument, Writer writer) throws IOException {
		assert xmldocument != null : AssertMessages.notNullParameter(0);
		assert writer != null : AssertMessages.notNullParameter(1);
		writeNode(xmldocument, writer);
	}
1324065
protected void writeResult(String testName, String resultXml) throws IOException {
        String finalPath = getXmlFileName(testName);
        Writer fw = null;
        try {
            fw = new BufferedWriter(
                    new OutputStreamWriter(
                        new FileOutputStream(finalPath),
                        "UTF-8"));
            fw.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
            fw.write(resultXml);
        } finally {
            if (fw != null) {
                fw.close();
            }
        }
    }
43342
protected void writeXml(MListTable<?> table, OutputStream outputStream) throws IOException {
		final List<?> list = table.getList();
		TransportFormatAdapter.writeXml((Serializable) list, outputStream);
	}
785241
private static void transform(final String xmlFileName, final String xsltFileName, final String outputFileName) {
        Source xsltSource = null;
        if (StringUtils.isNotBlank(xsltFileName)) {
            // Use the given stylesheet.
            xsltSource = new StreamSource(new File(xsltFileName));
        } else {
            // Use the default stylesheet.
            xsltSource = new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream(DEFAULT_XSLT_SHEET));
        }

        // Transform the given input file and put the result in the given output file.
        final Source xmlSource = new StreamSource(new File(xmlFileName));
        final Result xmlResult = new StreamResult(new File(outputFileName));

        XmlUtils.transform(xmlSource, xsltSource, xmlResult);
    }
1319562
private static Document parseXmlToDocument(final File xmlFile) {
        Document result = null;
        Reader reader = null;
        try {
            reader = new FileReader(xmlFile);
            result = parseXmlStream(reader);
        } catch (FileNotFoundException e) {
            // This should never happen...
        } finally {
            IOUtil.close(reader);
        }

        return result;
    }
678864
public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String sOpDirectory) {
        logger.entering(new Object[] { xmlSuites, suites, sOpDirectory });
        if (ListenerManager.isCurrentMethodSkipped(this)) {
            logger.exiting(ListenerManager.THREAD_EXCLUSION_MSG);
            return;
        }

        if (logger.isLoggable(Level.INFO)) {
            logger.log(Level.INFO, "Generating ExcelReport");
        }

        TestCaseResult.setOutputDirectory(sOpDirectory);

        // Generate data to suit excel report.
        this.generateSummaryData(suites);
        this.generateTCBasedData(allTestsResults);

        // Create the Excel Report
        this.createExcelReport();

        // Render the report
        Path p = Paths.get(sOpDirectory, reportFileName);

        try {
            Path opDirectory = Paths.get(sOpDirectory);
            if (!Files.exists(opDirectory)) {
                Files.createDirectories(Paths.get(sOpDirectory));
            }

            FileOutputStream fOut = new FileOutputStream(p.toFile());
            wb.write(fOut);
            fOut.flush();
        } catch (IOException e) {
            logger.log(Level.SEVERE, e.getMessage(), e);
        }

        if (logger.isLoggable(Level.INFO)) {
            logger.log(Level.INFO, "Excel File Created @ " + p.toAbsolutePath().toString());
        }
    }
65251
public static void writeFile(final Document input, final File output) {
        final StreamResult result = new StreamResult(new StringWriter());

        format(new DOMSource(input), result);

        try {
            new FileWriter(output).write(result.getWriter().toString());
        } catch (final IOException ioEx) {
            LOGGER.error("Problem writing XML to file.", ioEx);
        }
    }
409310
function TemplateFileLog(src, target) {
	this.templateFile = {
		source: src,
		target: target
	};
	this.isCompilationPerfect = true;
	this.templateTagLogs = new Table({
		chars: {
			'top-mid': '',
			'bottom-mid': '',
			'middle': '',
			'mid-mid': '',
		},
		style: {},
	});
}
326477
protected void updateReportSet(ReportSet value, String xmlTag, Counter counter, Element element)
   {
      Element root = element;
      Counter innerCount = new Counter(counter.getDepth() + 1);
      findAndReplaceSimpleElement(innerCount, root, "id", value.getId(), "default");
      findAndReplaceXpp3DOM(innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration());
      findAndReplaceSimpleElement(innerCount, root, "inherited", value.getInherited(), null);
      findAndReplaceSimpleLists(innerCount, root, value.getReports(), "reports", "report");
   }
373254
function logReports (url, reports, verbose) {
    var passes = '';
    var failures = '';

    grunt.log.writeln(chalk.underline(chalk.cyan('\nReport for ' + url + '\n')));
    reports.audit.forEach(function (el) {
        if (el.result === 'PASS') {
            passes += logSymbols.success + ' ' + el.heading + '\n';
        }

        if (el.result === 'FAIL') {
            failures += logSymbols.error + ' ' + el.heading + '\n';
            failures += el.elements + '\n\n';
        }
    });

    grunt.log.writeln(indent(failures, ' ', 2));
    grunt.log.writeln(indent(passes  , ' ', 2));

    if (verbose) {
      grunt.log.writeln('VERBOSE OUTPUT\n', reports.audit);
    }

    return !failures.length;
  }
976198
def render_html_report(summary, report_template=None, report_dir=None):
    
    if not report_template:
        report_template = os.path.join(
            os.path.abspath(os.path.dirname(__file__)),
            "templates",
            "report_template.html"
        )
        logger.log_debug("No html report template specified, use default.")
    else:
        logger.log_info("render with html report template: {}".format(report_template))

    logger.log_info("Start to render Html report ...")

    report_dir = report_dir or os.path.join(os.getcwd(), "reports")
    if not os.path.isdir(report_dir):
        os.makedirs(report_dir)

    start_at_timestamp = int(summary["time"]["start_at"])
    summary["time"]["start_datetime"] = datetime.fromtimestamp(start_at_timestamp).strftime('%Y-%m-%d %H:%M:%S')

    report_path = os.path.join(report_dir, "{}.html".format(start_at_timestamp))

    with io.open(report_template, "r", encoding='utf-8') as fp_r:
        template_content = fp_r.read()
        with io.open(report_path, 'w', encoding='utf-8') as fp_w:
            rendered_content = Template(
                template_content,
                extensions=["jinja2.ext.loopcontrols"]
            ).render(summary)
            fp_w.write(rendered_content)

    logger.log_info("Generated Html report: {}".format(report_path))

    return report_path