code: public static void serializeXMLDocument (Document doc, Writer output) throws TransformerException {
          // serialize XML document using identity transformation
          Transformer trans = TransformerFactory.newInstance().newTransformer();
          DOMSource source = new DOMSource(doc);
          StreamResult result = new StreamResult(output);
          trans.transform(source, result);
      }
docs: Writes the given Document to the given Writer using a no-op XSL transformation.