code: @SuppressWarnings("unchecked")
      public String toXml(Collection root, String rootName, String encoding) {
          try {
              CollectionWrapper wrapper = new CollectionWrapper();
              wrapper.collection = root;
  
              JAXBElement<CollectionWrapper> wrapperElement = new JAXBElement<CollectionWrapper>(
                      new QName(rootName), CollectionWrapper.class, wrapper);
  
              StringWriter writer = new StringWriter();
              createMarshaller(encoding).marshal(wrapperElement, writer);
  
              return writer.toString();
          } catch (JAXBException e) {
              throw new RuntimeException(e);
          }
      }
docs: Java Object->Xml, 特别支持对Root Element是Collection的情形.