Пример #1
0
  /*
   * (non-Javadoc)
   *
   * @see gov.nih.nci.codegen.framework.Transformer#execute(javax.jmi.reflect.RefObject,
   *      java.util.Collection)
   */
  public Collection execute(RefObject modelElement, Collection artifacts)
      throws TransformationException {
    if (modelElement == null) {
      log.error("model element is null");
      throw new TransformationException("model element is null");
    }
    if (!(modelElement instanceof Model)) {
      log.error("model element not instance of Model");
      throw new TransformationException("model element not instance of Model");
    }
    ArrayList newArtifacts = new ArrayList();
    UML13ModelElementFilter meFilt = new UML13ModelElementFilter();
    ArrayList umlExtentCol = new ArrayList();
    umlExtentCol.add(modelElement.refOutermostPackage());
    Collection classifiers = null;
    try {
      classifiers = _classifierFilt.execute(meFilt.execute(umlExtentCol));
    } catch (FilteringException ex) {
      log.error("couldn't filter model elements " + ex.getMessage());
      throw new TransformationException("couldn't filter model elements", ex);
    }
    Document doc = generateConfig(classifiers);
    XMLOutputter p = new XMLOutputter();
    p.setFormat(Format.getPrettyFormat());

    newArtifacts.add(new BaseArtifact("hibernate_config", modelElement, p.outputString(doc)));
    return newArtifacts;
  }
Пример #2
0
  /** @return */
  public String listHighestGameScores(String contentId, int count, User u) {
    u = checkUser(u);

    Element root = new Element("scores");
    root.setAttribute("content-id", contentId);

    List<ContentLog> list = contentLogDao.queryForHighest(contentId, count);
    list.addAll(contentLogDao.queryForUserLast(contentId, u.getUserId(), 1));
    int userOrder = contentLogDao.queryForOrder(list.get(list.size() - 1).getContentLogId());
    for (int i = 0; i < list.size(); i++) {
      Element e = new Element("user");
      if (i != list.size() - 1) {
        e.setAttribute("pm", String.valueOf(i + 1));
      } else {
        e.setAttribute("pm", String.valueOf(userOrder));
      }
      e.setAttribute("nc", list.get(i).getUserName());
      e.setAttribute("fs", String.valueOf(list.get(i).getScore()));
      root.addContent(e);
    }

    Document doc = new Document();
    doc.setRootElement(root);

    XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());

    return outputter.outputString(doc);
  }
 public String createTable() {
   Element root = new Element("table");
   root.setAttribute("border", "0");
   Document doc = new Document(root);
   Element thead = new Element("thead");
   Element th = new Element("th");
   th.addContent("A header");
   th.setAttribute("class", "aka_header_border");
   thead.addContent(th);
   Element th2 = new Element("th");
   th2.addContent("Another header");
   th2.setAttribute("class", "aka_header_border");
   thead.addContent(th2);
   root.addContent(thead);
   Element tr1 = new Element("tr");
   Element td1 = new Element("td");
   td1.setAttribute("valign", "top");
   td1.setAttribute("class", "cellBorders");
   td1.setText("cell contents");
   tr1.addContent(td1);
   root.addContent(tr1);
   XMLOutputter outp = new XMLOutputter();
   Format format = Format.getPrettyFormat();
   format.setOmitDeclaration(true);
   outp.setFormat(format);
   Writer writer = new StringWriter();
   try {
     outp.output(doc, writer);
   } catch (IOException e) {
     e
         .printStackTrace(); // To change body of catch statement use File | Settings | File
                             // Templates.
   }
   return writer.toString();
 }
 static void writeXMLfile(String fichier) {
   try {
     XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat());
     sortie.output(document, new FileOutputStream(fichier));
   } catch (java.io.IOException e) {
   }
 }
Пример #5
0
  public static void main(String[] args) throws Exception {
    Document document = new Document();

    Element root = new Element("��ϵ���б�").setAttribute(new Attribute("��˾", "A����"));

    document.addContent(root);

    Element contactPerson = new Element("��ϵ��");

    root.addContent(contactPerson);

    contactPerson
        .addContent(new Element("����").setText("����"))
        .addContent(new Element("��˾").setText("A��˾"))
        .addContent(new Element("�绰").setText("010-55556666"))
        .addContent(
            new Element("��ַ")
                .addContent(new Element("�ֵ�").setText("5��"))
                .addContent(new Element("����").setText("�Ϻ�"))
                .addContent(new Element("ʡ��").setText("�Ϻ���")));

    XMLOutputter output =
        new XMLOutputter(Format.getPrettyFormat().setIndent("    ").setEncoding("gbk"));

    output.output(document, new FileWriter("contact.xml"));
  }
 /**
  * @param selected
  * @param targetFile
  * @throws IOException
  */
 private void performSave(Archetype selected, File targetFile) throws IOException {
   XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
   FileWriter writer = new FileWriter(targetFile, false);
   outputter.output(selected.getXML(), writer);
   writer.flush();
   writer.close();
 }
Пример #7
0
  public static void main(String[] args) throws IOException {
    if (args.length != 2) {
      throw new RuntimeException("Usage: FitsJarMain <fits-config-dir> <input-file>");
    }

    File file = new File(args[1]);
    String filePath = file.getAbsolutePath();
    File configDir = new File(args[0]);
    String configDirPath = configDir.getAbsolutePath();
    if (!file.exists()) {
      throw new IllegalArgumentException("Arg file !exist: " + filePath);
    }
    if (!configDir.exists()) {
      throw new IllegalArgumentException("FITS configuration !exist: " + configDirPath);
    }

    try {
      addPath(configDir.getPath() + "/xml/nlnz");
    } catch (Exception e1) {
      e1.printStackTrace();
    }

    OutputStream out = new FileOutputStream(filePath + ".xml");
    try {
      Fits fits = new Fits(configDirPath);
      FitsOutput result = fits.examine(file);
      Document doc = result.getFitsXml();
      XMLOutputter serializer = new XMLOutputter(Format.getPrettyFormat());
      serializer.output(doc, out);
    } catch (FitsException e) {
      e.printStackTrace();
    } finally {
      out.close();
    }
  }
Пример #8
0
  /**
   * @param file
   * @throws IOException
   */
  public void write(final File file) throws IOException {
    Element root = new Element("FlowDescription");
    Document flowGraph = new Document(root);

    Element units = new Element("Units");
    root.addContent(units);

    for (Node node : getUnitList()) {
      Element unitElement = new Element("Unit");
      units.addContent(unitElement);

      writeXMLNode(node, unitElement);
    } // end node

    // now for connections
    Element connectionsElement = new Element("Connections");
    root.addContent(connectionsElement);

    for (Connection connection : getConnectionList()) {
      writeXMLConnection(connectionsElement, connection);
    }

    // output
    FileOutputStream fos = new FileOutputStream(file);
    new XMLOutputter(Format.getPrettyFormat()).output(flowGraph, fos);
  }
Пример #9
0
 /** Construction is intentionally unallowed */
 public XPathDebugger() {
   // Default to pretty format
   format = Format.getPrettyFormat();
   // Create these with a guaranteed encoding
   xmloutputter = new XMLOutputter(format);
   writer = new OutputStreamWriter(System.out);
 } // ctor
Пример #10
0
 void showDoc(java.io.OutputStream out) {
   XMLOutputter fmt = new XMLOutputter(Format.getPrettyFormat());
   try {
     fmt.output(doc, out);
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
 private static void updateFile(File deploymentFile, Document doc)
     throws JDOMException, IOException {
   FileOutputStream fos = new FileOutputStream(deploymentFile);
   XMLOutputter outp = new XMLOutputter(Format.getPrettyFormat());
   outp.output(doc, fos);
   fos.flush();
   fos.close();
 }
Пример #12
0
  public static void generateKanaLessonFromPlainText(String text_in, String filename_out) {
    // parse input
    ArrayList<String> als = new ArrayList<String>();
    String sep = " ";
    String2ArrayListOfString(text_in, als, sep);
    int size = als.size() / 2;

    /*// check parsing
    for(int i=0; i<als.size(); i++){
    	System.out.println(als.get(i));
    }*/

    // create document with root element
    Document doc = new Document(new Element("lesson"));

    // create an element for each char from text_in and add it to root element
    for (int i = 0; i < size; i++) {
      // maintain data
      String ch = als.get(2 * i);
      String read = als.get(2 * i + 1);

      int ch_codepoint = ch.codePointAt(0);

      // create blank elements to ease future editing
      Element chchar = new Element("char");
      Element reading = new Element("reading");
      Element translation = new Element("translation");
      Element example = new Element("example");
      example
          .addContent(new Element("text"))
          .addContent(new Element("reading"))
          .addContent(new Element("translation"));

      // fill char with content
      chchar.setAttribute("uid", "u+" + Integer.toHexString(ch_codepoint));
      chchar.setAttribute("ch", String.valueOf(ch));

      reading.setText(read);

      chchar.addContent(reading);
      chchar.addContent(translation);
      chchar.addContent(example);

      // add char to lesson
      doc.getRootElement().addContent(chchar);
    }

    // write document to file
    try {
      XMLOutputter out = new XMLOutputter();
      out.setFormat(Format.getPrettyFormat());
      out.output(doc, new FileOutputStream(filename_out));
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  @Test
  public void testAudioMD_noMD5() throws Exception {

    Fits fits = new Fits();

    // First generate the FITS output
    File input = new File("testfiles/test.wav");
    FitsOutput fitsOut = fits.examine(input);

    XMLOutputter serializer = new XMLOutputter(Format.getPrettyFormat());
    String actualXmlStr = serializer.outputString(fitsOut.getFitsXml());

    // Read in the expected XML file
    Scanner scan = new Scanner(new File("testfiles/output/FITS_test_wav_NO_MD5.xml"));
    String expectedXmlStr = scan.useDelimiter("\\Z").next();
    scan.close();

    // Set up XMLUnit
    XMLUnit.setIgnoreWhitespace(true);
    XMLUnit.setNormalizeWhitespace(true);

    Diff diff = new Diff(expectedXmlStr, actualXmlStr);

    // Initialize attributes or elements to ignore for difference checking
    diff.overrideDifferenceListener(
        new IgnoreNamedElementsDifferenceListener(
            "version",
            "toolversion",
            "dateModified",
            "fslastmodified",
            "lastmodified",
            "startDate",
            "startTime",
            "timestamp",
            "fitsExecutionTime",
            "executionTime",
            "filepath",
            "location"));

    DetailedDiff detailedDiff = new DetailedDiff(diff);

    // Display any Differences
    List<Difference> diffs = detailedDiff.getAllDifferences();
    if (!diff.identical()) {
      StringBuffer differenceDescription = new StringBuffer();
      differenceDescription.append(diffs.size()).append(" differences");

      System.out.println(differenceDescription.toString());
      for (Difference difference : diffs) {
        System.out.println(difference.toString());
      }
    }

    assertTrue("Differences in XML", diff.identical());
  }
Пример #14
0
  public static void main(String[] args) {
    String xml =
        "<root>"
            + "   <user name=\"Alice\" age=\"21\" dob=\"20-01-1988\"/>"
            + "   <user name=\"Bob\" age=\"23\" dob=\"01-05-1986\"/>"
            + "</root>";

    SAXBuilder builder = new SAXBuilder();
    try {
      Document document = builder.build(new ByteArrayInputStream(xml.getBytes()));

      //
      // Adding a new element to the root of the document using the
      // addContent method.
      //
      document.getRootElement().addContent(new Element("people").setAttribute("id", "1"));
      document.getRootElement().addContent(new Element("people").setAttribute("id", "1"));

      //
      // Add a new element. By adding a new element to the List of
      // children we can modified the xml document. Using
      // java.util.List makes the modification of XML document
      // simple and easy.
      //
      List children = document.getRootElement().getChildren();
      children.add(
          new Element("user")
              .setAttribute("name", "Carol")
              .setAttribute("age", "25")
              .setAttribute("dob", "06-03-1984"));

      //
      // Add element to the begining of the xml document.
      //
      children.add(
          0,
          new Element("user")
              .setAttribute("name", "Jimmy")
              .setAttribute("age", "25")
              .setAttribute("dob", "16-05-1984"));

      //
      // Remove the fourth element.
      //
      children.remove(3);

      XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
      outputter.output(document, System.out);
    } catch (JDOMException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
Пример #15
0
 public void saveXML(String path) {
   Document doc = new Document(getXML());
   XMLOutputter outp = new XMLOutputter(Format.getPrettyFormat());
   BufferedWriter outputStream;
   try {
     outputStream = new BufferedWriter(new FileWriter(path));
     outp.output(doc, outputStream);
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
Пример #16
0
  public static void saveXml(Document document) {
    XMLOutputter outputter = new XMLOutputter();
    Format format = Format.getPrettyFormat();
    outputter.setFormat(format);

    try {
      outputter.output(document, new FileWriter("C:\\Users\\adri\\Desktop\\test.xml"));
    } catch (IOException io) {
      System.out.println("IO ERROR");
    }
  }
Пример #17
0
  public static void saveXaml(Document document, String url) {
    XMLOutputter outputter = new XMLOutputter();
    Format format = Format.getPrettyFormat();
    outputter.setFormat(format);

    try {
      outputter.output(document, new FileWriter(url));
      System.out.println(url + "  --succesfull save--");
    } catch (IOException io) {
      System.out.println("IO ERROR");
    }
  }
  private String serializeDocument(Document doc) {
    // \r is converted to &#xD; by default escapeElementEntities XMLOutputter implementation
    final XMLOutputter out =
        new XMLOutputter(Format.getPrettyFormat().setOmitDeclaration(true)) {
          @Override
          public String escapeElementEntities(final String text) {
            return super.escapeElementEntities(text.replaceAll("\r", ""));
          }
        };

    return out.outputString(doc);
  }
Пример #19
0
public class Opml {

  private final List<Feed> feeds;
  private final Element root = new Element("opml");
  private final XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());

  public Opml(List<Feed> feeds) {
    this.feeds = feeds;
  }

  public String build() {
    insertRoot();
    insertHead();
    insertBody();
    return generateXmlString();
  }

  private void insertRoot() {
    root.setAttribute("version", "1.0");
  }

  private void insertHead() {
    Element head = new Element("head");
    Element title = new Element("title");
    title.setText(FluxxMessage.m("opml_title"));
    head.addContent(title);
    root.addContent(head);
  }

  private String generateXmlString() {
    Document document = new Document(root);
    return outputter.outputString(document);
  }

  private void insertBody() {
    Element body = new Element("body");
    root.addContent(body);
    for (Feed feed : feeds) {
      insertOutline(feed, body);
    }
  }

  private void insertOutline(Feed feed, Element body) {
    Element outline = new Element("outline");
    String title = feed.getTitle();
    outline.setAttribute("text", title);
    outline.setAttribute("title", title);
    outline.setAttribute("type", "rss");
    outline.setAttribute("xmlUrl", feed.getUrl());
    outline.setAttribute("htmlUrl", feed.getUrl());
    body.addContent(outline);
  }
}
  @Override
  public void generate(final File reportsDir, final VersionManagerSession session)
      throws VManException {
    Map<VersionlessProjectKey, Set<Plugin>> missingPlugins = session.getUnmanagedPluginRefs();
    if (missingPlugins.isEmpty()) {
      return;
    }
    Element plugins = new Element("plugins");

    for (Map.Entry<VersionlessProjectKey, Set<Plugin>> pluginsEntry : missingPlugins.entrySet()) {
      if (plugins.getContentSize() > 0) {
        plugins.addContent("\n\n");
      }

      plugins.addContent(new Comment("START: " + pluginsEntry.getKey()));

      for (Plugin dep : pluginsEntry.getValue()) {
        Element d = new Element("plugin");
        plugins.addContent(d);

        d.addContent(new Element("groupId").setText(dep.getGroupId()));
        d.addContent(new Element("artifactId").setText(dep.getArtifactId()));
        d.addContent(new Element("version").setText(dep.getVersion()));
      }

      plugins.addContent(new Comment("END: " + pluginsEntry.getKey()));
    }

    Element build = new Element("build");
    build.addContent(new Element("pluginManagement").setContent(plugins));

    Document doc = new Document(build);

    Format fmt = Format.getPrettyFormat();
    fmt.setIndent("  ");
    fmt.setTextMode(TextMode.PRESERVE);

    XMLOutputter output = new XMLOutputter(fmt);

    File report = new File(reportsDir, ID + ".xml");
    FileWriter writer = null;
    try {
      reportsDir.mkdirs();

      writer = new FileWriter(report);
      output.output(doc, writer);
    } catch (IOException e) {
      throw new VManException("Failed to generate %s report! Error: %s", e, ID, e.getMessage());
    } finally {
      closeQuietly(writer);
    }
  }
  /**
   * Saves the JDOM Document using a Format.getPrettyFormat
   *
   * @param doc
   * @param path
   * @return
   * @throws FileNotFoundException
   * @throws IOException
   */
  public static boolean saveDocument(Document doc, String path)
      throws FileNotFoundException, IOException {
    File f = new File(path);

    if (!f.exists()) {
      f.createNewFile();
    }
    XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat());
    FileOutputStream fos = new FileOutputStream(f);
    sortie.output(doc, fos);
    fos.close();
    f = null;
    return true;
  }
Пример #22
0
 public static void writeXMLDocumentToFile(File file, Document document) {
   try {
     FileOutputStream fos = new FileOutputStream(file);
     XMLOutputter xmlout = new XMLOutputter();
     xmlout.setFormat(Format.getPrettyFormat());
     xmlout.output(document, fos);
     fos.flush();
     fos.close();
   } catch (FileNotFoundException e) {
     e.printStackTrace();
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
Пример #23
0
  public static void writeXMLStringToFile(File file, String str) {
    SAXBuilder saxb = new SAXBuilder();
    StringReader sr = new StringReader(str);
    try {
      Document d = saxb.build(sr);

      XMLOutputter xmlout = new XMLOutputter();
      xmlout.setFormat(Format.getPrettyFormat());
      xmlout.output(d, new FileOutputStream(file));
    } catch (JDOMException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
Пример #24
0
 private void convertReactomeToGPML(GKInstance pathway, String outputFileName) throws Exception {
   Long dbID = pathway.getDBID();
   System.out.println("converting pathway #" + dbID + " " + pathway.getDisplayName() + "...");
   Document doc = r2gConverter.convertPathway(pathway);
   XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
   outputter.output(doc, new FileOutputStream(outputFileName));
   /*
   // Test loading using JDOM and validation
   SAXBuilder builder = new SAXBuilder(true);
   builder.setFeature("http://apache.org/xml/features/validation/schema", true);
   builder.setProperty("http://apache.org/xml/properties/schema/external-schemaLocation",
                       "http://genmapp.org/GPML/2008a http://svn.bigcat.unimaas.nl/pathvisio/trunk/GPML2008a.xsd");
   doc = builder.build(new File(outputFileName));
   */
 }
Пример #25
0
  private void setupDoc() {
    document = new Document();
    rootTag = new Element("jnlp");
    document.setRootElement(rootTag);

    if (!options.containsKey("url")) {
      Comment Codebase = new Comment("Replace the codebase URL with your own");
      rootTag.addContent(Codebase);
    }

    rootTag.setAttribute("codebase", url);
    rootTag.setAttribute("href", fileName);

    out = new XMLOutputter(org.jdom.output.Format.getPrettyFormat());
  }
Пример #26
0
  private void appendResult(String param, Document result) {

    StringWriter sw = new StringWriter();
    DOMBuilder builder = new DOMBuilder();
    org.jdom.Document jdomDoc = builder.build(result);

    XMLOutputter out = new XMLOutputter(Format.getPrettyFormat());

    try {
      //			out.output(jdomDoc, System.out);
      out.output(jdomDoc, sw);
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    //		OutputFormat format = new OutputFormat(result);
    //		format.setIndenting(true);
    //		format.setPreserveSpace(true);
    //		format.setLineSeparator(System.getProperty("line.separator"));
    //		format.setMethod(Method.XML);

    //		XMLSerializer serial = new XMLSerializer(sw, format);
    //		try {
    //			DOMSerializer domserial = serial.asDOMSerializer();
    //			domserial.serialize(result);
    //		} catch (Exception e) {
    //			// TODO: handle exception
    //		}

    try {
      response.put(param, sw.getBuffer().toString());
    } catch (JSONException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    //		if(response.length() == 0) {
    //			response.append(param);
    //			response.append("=");
    //			response.append(sw.getBuffer().toString());
    //		} else {
    //			response.append("&");
    //			response.append(param);
    //			response.append("=");
    //			response.append(sw.getBuffer().toString());
    //		}
  }
Пример #27
0
  private void writeToDisk(Document d, String filename) throws IOException {
    XMLOutputter outputter = new XMLOutputter();
    outputter.setFormat(Format.getPrettyFormat());

    File exportDir = new File("export");
    if (!exportDir.exists() || !exportDir.isDirectory()) {
      exportDir.mkdir();
    }
    File currentDir = new File(".");

    BufferedWriter bw;
    File file = new File(currentDir.getCanonicalPath() + "/export/" + filename);
    bw = new BufferedWriter(new FileWriter(file));
    outputter.output(d, bw);
    bw.close();
  }
  public static void main(String[] args) {
    SAXBuilder saxBuilder = new SAXBuilder();
    try {
      Document doc = saxBuilder.build(new File("domdb.xml"));

      // 首先创建好节点
      Element eltDb = new Element("db");
      Element eltDriver = new Element("driver");
      Element eltUrl = new Element("url");
      Element eltUser = new Element("user");
      Element eltPassword = new Element("password");

      // 设置节点的值
      eltDriver.setText("com.mysql.jdbc.Driver");
      eltUrl.setText("jdbc:mysql://localhost/mySql");
      eltUser.setText("root");
      eltPassword.setText("xlc");

      // 添加到根节点
      eltDb.addContent(eltDriver);
      eltDb.addContent(eltUrl);
      eltDb.addContent(eltUser);
      eltDb.addContent(eltPassword);
      // 根节点设置属性
      eltDb.setAttribute("type", "mysql");

      Element root = doc.getRootElement();
      // root.removeChild("db");//删除节点
      root.addContent(eltDb); // 增加节点

      // 修改db节点中内容
      root.getChild("db").getChild("user").setText("system");
      root.getChild("db").getChild("password").setText("manager");

      XMLOutputter xmlOut = new XMLOutputter();

      // 设置XML格式
      Format fmt = Format.getPrettyFormat();
      fmt.setIndent("    ");
      fmt.setEncoding("utf-8");

      xmlOut.setFormat(fmt);
      xmlOut.output(doc, System.out);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Пример #29
0
  public void deployElement(Element e, String fileName, boolean encrypt, boolean isTransient)
      throws ISOException, IOException, GeneralSecurityException {
    e = ((Element) e.clone());

    XMLOutputter out = new XMLOutputter(Format.getPrettyFormat());
    Document doc = new Document();
    doc.setRootElement(e);
    File qbean = new File(deployDir, fileName);
    if (isTransient) {
      e.setAttribute("instance", getInstanceId().toString());
      qbean.deleteOnExit();
    }
    FileWriter writer = new FileWriter(qbean);
    if (encrypt) doc = encrypt(doc);
    out.output(doc, writer);
    writer.close();
  }
Пример #30
0
 public String getAsXML() {
   // following lines uses the old JDOM jar
   //        xmlOutputter.setIndent(true);
   //        xmlOutputter.setIndent("  ");
   //        xmlOutputter.setNewlines(true);
   //        xmlOutputter.setExpandEmptyElements(false);
   //        xmlOutputter.setOmitEncoding(true);
   //        xmlOutputter.setOmitDeclaration(true);
   //        xmlOutputter.setTextNormalize(true);
   final Format prettyFormat = Format.getPrettyFormat();
   prettyFormat.setExpandEmptyElements(false);
   prettyFormat.setOmitEncoding(true);
   prettyFormat.setOmitDeclaration(true);
   prettyFormat.setTextMode(Format.TextMode.NORMALIZE);
   final XMLOutputter xmlOutputter = new XMLOutputter(prettyFormat);
   return xmlOutputter.outputString(createRootTree("class name list template"));
 }