docs: public static String obj2Xml(Class clazz, Object o)  throws JAXBException, ParserConfigurationException {
          Document doc = obj2Doc(clazz, o);
  
          DOMImplementationLS domImplementation = (DOMImplementationLS) doc.getImplementation();
          LSSerializer lsSerializer = domImplementation.createLSSerializer();
          DOMConfiguration domConfiguration = lsSerializer.getDomConfig();
          if (domConfiguration.canSetParameter("format-pretty-print", Boolean.TRUE)) {
              lsSerializer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE);
          }
          lsSerializer.setNewLine("\n");
  
          try {
              // Encode as UTF-8
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              LSOutput lsOutput = domImplementation.createLSOutput();
              lsOutput.setEncoding("UTF-8");
              lsOutput.setByteStream(baos);
              lsSerializer.write(doc, lsOutput);
  
              return baos.toString("UTF-8");
          }
          catch (UnsupportedEncodingException uee) {
              return lsSerializer.writeToString(doc); // Produces UTF-16
          }
      }