users@jaxb.java.net

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

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Tue, 17 Nov 2009 15:18:31 +0100

The behaviour in 2.1.12 is correct. It's certainly possible to create all
sorts of
documents that do not conform to certain schema properties. If you validate
the generated content tree, an exception will be thrown.
-W


On Tue, Nov 17, 2009 at 10:27 AM, Hanh-Missi Tran <
hanh-missi.tran_at_courtanet.net> wrote:

> 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.
>