If I marshal java classes (generated through xjc from a xsd schema) using jaxb I correctly get this
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.013.001.10" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:pain.013.001.010 pain.013.001.10.xsd">
I get this result annotating root class with
@XmlRootElement(name = "Document", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.013.001.10")
and setting Marshaller JAXB_SCHEMA_LOCATION property
marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION,
"urn:iso:std:iso:20022:tech:xsd:pain.013.001.010 pain.013.001.10.xsd");
I couldn't figure out how to get the same result with Jackson. This is the class annotation
@JacksonXmlRootElement(namespace = "urn:iso:std:iso:20022:tech:xsd:pain.013.001.10")
and this the code fragment
XmlMapper mapper = XmlMapper.xmlBuilder().defaultUseWrapper(false).build();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
mapper.setSerializationInclusion(Include.NON_NULL);
mapper.registerModule(new JakartaXmlBindAnnotationModule());
mapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true);
ByteArrayOutputStream out = new ByteArrayOutputStream();
mapper.writeValue(out, document);
System.out.println(out);
But doing so the result is
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.013.001.10">
How can I get schema location written in the output like in the jaxb approach?
Many thanks