code: public String serialize(T object, boolean includeXmlDeclaration) {
      try {
        Marshaller marshaller = jaxbContext.createMarshaller();
        marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.valueOf(!includeXmlDeclaration));
        JAXBElement<T> element =
            new JAXBElement<T>(qname, clazz, object);
        StringWriter stringWriter = new StringWriter();
        marshaller.marshal(element, stringWriter);
        return stringWriter.toString();
      } catch (JAXBException e) {
        throw new SerializationException(String.format("Could not serialize object: %s.", object), e);
      }
    }
docs: Serializes the object with the option to include or exclude the XML declaration.
  
  @throws SerializationException if we cannot serialize the object.