Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » [bug] MOXy @XmlNullPolicy not working with enums
[bug] MOXy @XmlNullPolicy not working with enums [message #1838511] Fri, 26 February 2021 19:00
ender tercero is currently offline ender terceroFriend
Messages: 1
Registered: February 2021
Junior Member
I use MOXy to create XML responses for a SOAP web service and I need some tags to be printed even though the value is null. I'm using MOXy's XmlNullPolicy annotation for that purpose.

Here's an example:

@XmlType(name = "", propOrder = {
@XmlRootElement(name = "Response")
public class Response {
    @XmlElement(name = "Prop1")
    @XmlSchemaType(name = "string")
    @XmlNullPolicy(nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
    protected MyEnumType prop1;
    @XmlElement(name = "Prop2")
    @XmlNullPolicy(nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
    protected String prop2;

I'm expecing the following resulting XML:

But I'm getting:

Prop1 is missing even though XmlNullPolicy annotation is correctly defined.

Any idea or solution?
Previous Topic:Metamodel generation issue for @NotNull and @Lob byte[]
Next Topic:EclipseLink 3.0 post-upgrade performance degradation
Goto Forum:

Current Time: Sun Jan 16 11:13:25 GMT 2022

Powered by FUDForum. Page generated in 0.01527 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top