java – Removing ns2 and xmlns from xml output when marshalling with JAXB

In java i’m doing the following conversion:

json -> POJO with Jackson
POJO -> xml with JAXB

The problem I encounter when validating the xml based upon xsd’s is it throws an error because of the presence of ns2 and xmlns:ns2, like so .
I only need X001.

One thing to note is that I have no control over the POJO creation, because the generating of these objects is being done based upon other xsd’s. These xsd’s shouldn’t be changed.

I would like to know if it’s possible to change the bindings.xjb file to accomplish this and how or is there a different approach to this?

Altering xml string after validation but this isn’t desirable.

Read more here: Source link