Update: please notice this is not a duplicate because most of the solutions includes modifying the model which I'm unable to do.
I got a requirement to change the XML in a SOAP request to use short tags whenever possible.
Even though the effect is the same, I need to replace:
<MyObject></MyObject>
long tag
with
<MyObject/>
short tag
While doing so I noticed that both the default javax JAXB and Moxy will:
- create a short tag when Marshalling MyObjects that I instantiate with
new
and don't populate the members - create a long tag when the object being Marshalled is a String.
Is this a known bug on JAXB?
I understand that with Moxy I could use a DescriptorCustomizer (like the one mentioned here) to control the behavior of null values but I'm using a proprietary library which I can't change.
Is there a way to change this behavior while creating the marshaller?