code: protected static String getHumanReadableXml(final Node node) {
          StringWriter toReturn = new StringWriter();
  
          try {
              Transformer transformer = getFactory().newTransformer();
              transformer.setOutputProperty(OutputKeys.INDENT, "yes");
              transformer.setOutputProperty(OutputKeys.STANDALONE, "yes");
              transformer.transform(new DOMSource(node), new StreamResult(toReturn));
          } catch (TransformerException e) {
              throw new IllegalStateException("Could not transform node [" + node.getNodeName() + "] to XML", e);
          }
  
          return toReturn.toString();
      }
docs: Converts the provided DOM Node to a pretty-printed XML-formatted string.
  
  @param node The Node whose children should be converted to a String.
  @return a pretty-printed XML-formatted string.