code: protected String getFormattedNodeXml(final Node nodeToConvert, boolean formatXml) {
          String formattedNodeXml;
          try {
              final int numberOfBlanksToIndent = formatXml ? 2 : -1;
              final Transformer transformer = createXmlTransformer(numberOfBlanksToIndent);
              final StringWriter buffer = new StringWriter();
              transformer.transform(new DOMSource(nodeToConvert), new StreamResult(buffer));
              formattedNodeXml = buffer.toString();
          } catch (final Exception e) {
              formattedNodeXml = "ERROR " + e.getMessage();
          }
          return formattedNodeXml;
      }
docs: Formats a node with the help of an identity XML transformation.
  
  @param nodeToConvert the node to format
  @param formatXml true if the Comparison was generated with {@link
  org.xmlunit.builder.DiffBuilder#ignoreWhitespace()} - this affects the indentation of the generated output
  @return the fomatted XML
  
  @since XMLUnit 2.4.0