/**
   * Return the VM definitions contained in this object as a String of XML. The String is suitable
   * for storing in the workbench preferences.
   *
   * <p>The resulting XML is compatible with the static method <code>parseXMLIntoContainer</code>.
   *
   * @return String the results of flattening this object into XML
   * @throws IOException if this method fails. Reasons include:
   *     <ul>
   *       <li>serialization of the XML document failed
   *     </ul>
   *
   * @throws ParserConfigurationException if creation of the XML document failed
   * @throws TransformerException if serialization of the XML document failed
   */
  public String getAsXML() throws ParserConfigurationException, IOException, TransformerException {

    // Create the Document and the top-level node
    Document doc = LaunchingPlugin.getDocument();
    Element config = doc.createElement("vmSettings"); // $NON-NLS-1$
    doc.appendChild(config);

    // Set the defaultVM attribute on the top-level node
    if (getDefaultVMInstallCompositeID() != null) {
      config.setAttribute("defaultVM", getDefaultVMInstallCompositeID()); // $NON-NLS-1$
    }

    // Create a node for each install type represented in this container
    Set vmInstallTypeSet = getVMTypeToVMMap().keySet();
    Iterator keyIterator = vmInstallTypeSet.iterator();
    while (keyIterator.hasNext()) {
      IVMInstallType vmInstallType = (IVMInstallType) keyIterator.next();
      Element vmTypeElement = vmTypeAsElement(doc, vmInstallType);
      config.appendChild(vmTypeElement);
    }

    // Serialize the Document and return the resulting String
    return LaunchingPlugin.serializeDocument(doc);
  }