您可以配置XMLMapper来编写XML标头。 XmlMapper xmlMapper =newXmlMapper(); xmlMapper.configure( ToXmlGenerator.Feature.WRITE_XML_DECLARATION,true); 例如: importcom.fasterxml.jackson.dataformat.xml.XmlMapper;importcom.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator;importjava.io.IOException;publicclass...