Exemplo n.º 1
0
  /**
   * エラーリストを XMLとして出力する。
   *
   * @param el エラーリスト
   */
  public static void outputError(UDF_ErrorList el) {

    Document doc = UDF_Util.genDocument();
    Element root = doc.createElement("udf-error");

    for (int i = 0; i < el.getSize(); i++) {
      el.getError(i).toXML(doc, root);
    }

    doc.appendChild(root);

    try {
      OutputFormat format = new OutputFormat(doc, "UTF-8", true);
      format.setLineWidth(0);
      OutputStreamWriter osw = new OutputStreamWriter(System.out, "UTF-8");
      XMLSerializer serial = new XMLSerializer(osw, format);
      serial.serialize(doc.getDocumentElement());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }