users@jaxb.java.net

Behavior of marshaller when a required attribute has a null value ?

From: Hanh-Missi Tran <hanh-missi.tran_at_courtanet.net>
Date: Tue, 17 Nov 2009 10:27:16 +0100

Hi

In my code, I have a field that is to be transformed into a required
attribute:
    @XmlAttribute(required = true)
    protected String code;

What's the expected behavior if I try to marshall the object when the value
of this field is null ?

With JAXB 2.1.11, the attribute is generated with an empty value (code="").
With JAXB 2.1.12, the attribute is not created.