private void writeTag(String tag, String value) { out.startNode(tag); out.setValue(value); out.endNode(); }
private void writeTag(String tag, String value) { out.startNode(tag); out.setValue(value); out.endNode(); }
Vector<String[]> recipes = ... (your vector of recipes) PrettyPrintWriter writer = new PrettyPrintWriter(new FileWriter("recipes.txt")); writer.startNode("recipes"); for (String[] recipe: recipes) { writer.startNode("recipe"); // you might write out attributes, such as the recipe name for (String ingredient: recipe) { writer.startNode("ingredient"); writer.setValue(ingredient); writer.endNode(); } writer.endNode(); } writer.endNode(); writer.close();
private void writeTag(String tag, String value, String attributeName, String attributeValue) { out.startNode(tag); out.addAttribute(attributeName, attributeValue); out.setValue(value); out.endNode(); }
private void writeTag(String tag, String value, String attributeName, String attributeValue) { out.startNode(tag); out.addAttribute(attributeName, attributeValue); out.setValue(value); out.endNode(); }
public void endTarget(Target target) { out.startNode("table"); out.startNode("tr"); writeTag("th", "Product"); writeTag("th", currentMetric.unit()); out.endNode(); for (Iterator iterator = resultsForTarget.iterator(); iterator.hasNext();) { MetricResult metricResult = (MetricResult) iterator.next(); out.startNode("tr"); writeTag("td", metricResult.product.toString()); if (metricResult.exception == null) { writeTag("td", String.valueOf(metricResult.result), "class", "success"); long percentage = Math.round(Math.abs(metricResult.result / largestMetricForTarget) * 100.0); out.startNode("td"); out.addAttribute("style", "width: 400px;"); writeTag("div", "", "style", "height: 100%; width: " + percentage + "%; background-color: blue;"); out.endNode(); } else { writeTag("td", "FAIL", "class", "fail"); writeTag("td", metricResult.exception.toString()); } out.endNode(); } out.endNode(); out.flush(); // Flush now, so progress can be seen with slow benchmarks. }
public void endTarget(Target target) { out.startNode("table"); out.startNode("tr"); writeTag("th", "Product"); writeTag("th", currentMetric.unit()); out.endNode(); for (Iterator iterator = resultsForTarget.iterator(); iterator.hasNext();) { MetricResult metricResult = (MetricResult) iterator.next(); out.startNode("tr"); writeTag("td", metricResult.product.toString()); if (metricResult.exception == null) { writeTag("td", String.valueOf(metricResult.result), "class", "success"); long percentage = Math.round(Math.abs(metricResult.result / largestMetricForTarget) * 100.0); out.startNode("td"); out.addAttribute("style", "width: 400px;"); writeTag("div", "", "style", "height: 100%; width: " + percentage + "%; background-color: blue;"); out.endNode(); } else { writeTag("td", "FAIL", "class", "fail"); writeTag("td", metricResult.exception.toString()); } out.endNode(); } out.endNode(); out.flush(); // Flush now, so progress can be seen with slow benchmarks. }
public void startBenchmark() { out.startNode("html"); out.startNode("head"); writeTag("title", title); writeTag("style", css(), "type", "text/css"); out.endNode(); out.startNode("body"); writeTag("h1", title); }
public void startBenchmark() { out.startNode("html"); out.startNode("head"); writeTag("title", title); writeTag("style", css(), "type", "text/css"); out.endNode(); out.startNode("body"); writeTag("h1", title); }