code: public String serialize(Node node, boolean format) {
          Result result;
          StringWriter dest;
  
          if (node == null) {
              throw new IllegalArgumentException();
          }
          dest = new StringWriter();
          result = new StreamResult(dest);
          try {
              serialize(node, result, format);
          } catch (IOException e) {
              throw new IllegalStateException(e);
          }
          return dest.getBuffer().toString();
      }
docs: does not genereate encoding headers