protected String toString(Document d) throws Exception {
    // Just to be safe, no newline at the end
    String output = XMLUtil.documentToString(d);
    while (output.endsWith("\n") || output.endsWith("\r")) {
      output = output.substring(0, output.length() - 1);
    }

    return output;
  }
  public String generate(Service service) throws DescriptorBindingException {
    try {
      log.fine("Generating XML descriptor from service model: " + service);

      return XMLUtil.documentToString(buildDOM(service));

    } catch (Exception ex) {
      throw new DescriptorBindingException("Could not build DOM: " + ex.getMessage(), ex);
    }
  }