docs: private static void serializeDocToStream(final OutputStream output, final Document doc) throws IOException {
          final OutputFormat format = OutputFormat.createPrettyPrint();
          final XMLWriter writer = new XMLWriter(output, format);
          writer.write(doc);
          writer.flush();
      }