code: private String formatXml(@Nullable Source xmlSource) {
      Transformer transformer = transformerSupplier.get();
      if (xmlSource != null && transformer != null) {
        try {
          StreamResult result = new StreamResult(new StringWriter());
          transformer.transform(xmlSource, result);
          return result.getWriter().toString();
        } catch (TransformerException e) {
          libLogger.warn("Unable to pretty print XML: {}", e);
        } catch (NullPointerException e) {
          libLogger.warn("Unable to pretty print XML: {}", e);
        } catch (ArrayIndexOutOfBoundsException e) {
          libLogger.warn("Unable to pretty print XML: {}", e);
        } catch (EmptyStackException e) {
          libLogger.warn("Unable to pretty print XML: {}", e);
        }
      }
      return null;
    }
docs: Formats/pretty prints the XML source.
  
  @return the formatted XML if formatting succeeded, else null