code: public static String docToString1(Document dom) {
          StringWriter sw = new StringWriter();
          DOM2Writer.serializeAsXML(dom, sw);
          return sw.toString();
      }
docs: Convert a DOM tree into a String using Dom2Writer
  
  @return XML as String
  @param dom
  DOM object to convert