docs: public String asString(Document doc) {
          try {
              DOMSource domSource = new DOMSource(doc);
              StringWriter writer = new StringWriter();
              StreamResult result = new StreamResult(writer);
              TransformerFactory tf = TransformerFactory.newInstance();
              Transformer transformer = tf.newTransformer();
              transformer.transform(domSource, result);
              return writer.toString();
          } catch (TransformerException e) {
              throw new IllegalStateException(e);
          }
      }