code: 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();
              }
          }
      }
docs: Writes XML result to disk.
  @param testName name of test.
  @param resultXml XML description of test outcome.
  @throws IOException if unable to write result.