code: public static String serialize(Document doc) {
          LSSerializer serializer = configurer.createLSSerializer();
  
          LSOutput output = configurer.createLSOutput();
          String charset = getTargetCharset(doc).displayName();
          output.setEncoding(charset);
  
          StringWriter writer = new StringWriter();
          output.setCharacterStream(writer);
  
          serializer.write(doc, output);
  
          return writer.toString();
      }
docs: Serializes a DOM document
  @param doc
  @throws CitrusRuntimeException
  @return serialized XML string