Static method which generates the Junit xml string from results

        :param results: Results as ResultList object.
        :return: Junit xml format string.
195386
def __generate(results):
        
        doc, tag, text = Doc().tagtext()

        # Counters for testsuite tag info
        count = 0
        fails = 0
        errors = 0
        skips = 0

        for result in results:
            # Loop through all results and count the ones that were not later retried.
            if result.passed() is False:
                if result.retries_left > 0:
                    # This will appear in the list again, move on
                    continue
            count += 1
            if result.passed():
                # Passed, no need to increment anything else
                continue
            elif result.skipped():
                skips += 1
            elif result.was_inconclusive():
                errors += 1
            else:
                fails += 1

        with tag('testsuite',
                 tests=str(count),
                 failures=str(fails),
                 errors=str(errors),
                 skipped=str(skips)):
            for result in results:
                if result.passed() is False and result.retries_left > 0:
                    continue
                class_name = result.get_tc_name()
                models = result.get_dut_models()
                if models:
                    class_name = class_name + "." + models
                name = result.get_toolchain()
                with tag('testcase', classname=class_name, name=name,
                         time=result.get_duration(seconds=True)):
                    if result.stdout:
                        with tag('system-out'):
                            text(result.stdout)
                    if result.passed():
                        continue
                    elif result.skipped():
                        with tag('skipped'):
                            text(result.skip_reason)
                    elif result.was_inconclusive():
                        with tag('error', message=hex_escape_str(result.fail_reason)):
                            text(result.stderr)
                    else:
                        with tag('failure', message=hex_escape_str(result.fail_reason)):
                            text(result.stderr)
        return indent(
            doc.getvalue(),
            indentation=' '*4
        )
727342
private static List<String> getResultIds(JsonNode result)
  {
    JsonNode resultIds = result.path("data").path("resultIds");
    if (resultIds.isNull() ||
        resultIds.isMissingNode() ||
        resultIds.asText().isEmpty())
    {
      return Collections.emptyList();
    }
    return new ArrayList<>(Arrays.asList(resultIds.asText().split(",")));
  }
606227
def _output_results(
            self):
        
        self.log.info('starting the ``_output_results`` method')

        content = ""
        maxNameLen = 0

        for r in self.results:
            if maxNameLen < len(r["ned_name"]):
                maxNameLen = len(r["ned_name"])

        if len(self.results) == 0:
            content += "No resuls found"
        else:
            thisHeader = "| "
            thisLine = "| "
            for head in self.headers:
                if head == "ned_name":
                    s = maxNameLen
                else:
                    s = self.resultSpacing
                thisHeader += str(head).ljust(s,
                                              ' ') + " | "
                thisLine += ":".ljust(s,
                                      '-') + " | "
            content += thisHeader
            content += "\n" + thisLine
            for r in self.results:
                thisRow = "| "
                for head in self.headers:
                    if head == "ned_name":
                        s = maxNameLen
                    else:
                        s = self.resultSpacing
                    thisRow += str(r[head]).ljust(s,
                                                  ' ') + " | "
                content += "\n" + thisRow

        if self.quiet == False:
            print content
        if self.outputFilePath:
            import codecs
            writeFile = codecs.open(
                self.outputFilePath, encoding='utf-8', mode='w')
            writeFile.write(content)
            writeFile.close()

        self.log.info('completed the ``_output_results`` method')
        return None
567416
def print_schema_results(results, level=0):
    
    for error in results.errors:
        print_level(logger.error, _RED + "[X] %s", level, error)
855797
def xml_result(xml: str,
               extraheaders: TYPE_WSGI_RESPONSE_HEADERS = None) \
        -> WSGI_TUPLE_TYPE:
    
    extraheaders = extraheaders or []
    return 'text/xml; charset=utf-8', extraheaders, xml.encode("utf-8")
400745
def display_results(results, detailed=False):
    
    # print("\nVALIDATOR RESULTS")
    # print("======================\n")

    if not detailed:
        print('FILENAME......................................... STATUS..........')

    for entry in results:
        try:
            if detailed:
                print("\n{}".format(entry["filename"]))
                print(create_detailed_results(entry))
            else:
                print("{:<50}{}".format(entry["filename"], entry["status"]))
        except Exception as e:
            logger_validator_api.debug("display_results: Exception: {}".format(e))
            print("Error: display_results: {}".format(e))

    return
925242
private String formatXml(@Nullable Source xmlSource) {
    Transformer transformer = transformerSupplier.get();
    if (xmlSource != null && transformer != null) {
      try {
        StreamResult result = new StreamResult(new StringWriter());
        transformer.transform(xmlSource, result);
        return result.getWriter().toString();
      } catch (TransformerException e) {
        libLogger.warn("Unable to pretty print XML: {}", e);
      } catch (NullPointerException e) {
        libLogger.warn("Unable to pretty print XML: {}", e);
      } catch (ArrayIndexOutOfBoundsException e) {
        libLogger.warn("Unable to pretty print XML: {}", e);
      } catch (EmptyStackException e) {
        libLogger.warn("Unable to pretty print XML: {}", e);
      }
    }
    return null;
  }
1257430
public String toXML(boolean hasResult) throws IOException{
		StringWriter swriter = new StringWriter();

		PrintWriter writer = new PrintWriter(swriter);
		PrettyXMLWriter xml = new PrettyXMLWriter(writer);

		xml.openTag("alignment");
		xml.attribute("hasResult", String.valueOf(hasResult));
		xml.closeTag("alignment");
		xml.close();
		return swriter.toString();
	}
34905
def toxml(self):
        

        xmlstr = '<OnCondition test="{0}"'.format(self.test)

        chxmlstr = ''

        for action in self.actions:
            chxmlstr += action.toxml()

        if chxmlstr:
            xmlstr += '>' + chxmlstr + '</OnCondition>'
        else:
            xmlstr += '/>'

        return xmlstr
157534
def _save_junit(self):
        
        report = ReportJunit(self)
        file_name = report.get_latest_filename("result.junit.xml", "")
        report.generate(file_name)

        file_name = report.get_latest_filename("junit.xml", "../")
        report.generate(file_name)
841639
public void generateReport(List<XmlSuite> xmlSuites,
                               List<ISuite> suites,
                               String outputDirectoryName)
    {
        removeEmptyDirectories(new File(outputDirectoryName));
        
        File outputDirectory = new File(outputDirectoryName, REPORT_DIRECTORY);
        outputDirectory.mkdirs();

        Collection<TestClassResults> flattenedResults = flattenResults(suites);

        for (TestClassResults results : flattenedResults)
        {
            VelocityContext context = createContext();
            context.put(RESULTS_KEY, results);

            try
            {
                generateFile(new File(outputDirectory, results.getTestClass().getName() + '_' + RESULTS_FILE),
                             RESULTS_FILE + TEMPLATE_EXTENSION,
                             context);
            }
            catch (Exception ex)
            {
                throw new ReportNGException("Failed generating JUnit XML report.", ex);
            }
        }
    }
976561
public static String composeMessage(List<ValidationResult> results) {
		StringBuilder builder = new StringBuilder();
		builder.append("Validation failed");

		if (results != null && results.size() > 0) {
			boolean first = true;
			for (ValidationResult result : results) {
				if (result.getType() != ValidationResultType.Information) {
					if (!first)
						builder.append(": ");
					else
						builder.append(", ");
					builder.append(result.getMessage());
					first = false;
				}
			}
		}

		return builder.toString();
	}
38731
public static String reportToXml(Report report) {
		XStream xstream = XStreamFactory.createXStream();
		ByteArrayOutputStream bos = new ByteArrayOutputStream();
		xstream.toXML(report, bos);
		return bos.toString();
	}
537204
function output_as_xml($results){
		LogMaster::log("Edit operation finished",$results);
		ob_clean();
		header("Content-type:text/xml");
		echo "<?xml version='1.0' ?>";
		echo "<data>";
		for ($i=0; $i < sizeof($results); $i++)
			echo $results[$i]->to_xml();
		echo "</data>";
	}
528154
public static Map<String, String> convertResultStringToMap(String result) {
		Map<String, String> map = null;

		if (StringUtils.isNotBlank(result)) {
			if (result.startsWith("{") && result.endsWith("}")) {
				result = result.substring(1, result.length() - 1);
			}
			map = parseQString(result);
		}

		return map;
	}
994653
def append(self, resultFile, resultElem, all_columns=False):
        
        self._xml_results += [(result, resultFile) for result in _get_run_tags_from_xml(resultElem)]
        for attrib, values in RunSetResult._extract_attributes_from_result(resultFile, resultElem).items():
            self.attributes[attrib].extend(values)

        if not self.columns:
            self.columns = RunSetResult._extract_existing_columns_from_result(resultFile, resultElem, all_columns)
1060819
def toxml(self):
        

        return '<Run component="{0}" variable="{1}" increment="{2}" total="{3}"/>'.format(self.component,
                                                                                          self.variable,
                                                                                          self.increment,
                                                                                          self.total)