users@jaxb.java.net

Re: JAXB 2.0 default values

From: Dmitri Colebatch <colebatchd_at_gmail.com>
Date: Wed, 7 Sep 2005 07:47:09 +1000

Hi Joe,

[snip]

> If a child element is missing,
> nothing is done by the unmarshal process.

I don't understand the logic behind this. Are you saying that if I have:

<foo>
  <bar />
</foo>

where in the schema bar has a default value of "x" then
foo.getBar().equals("x")? Yet if I have

<foo />

foo.getBar() is null?

Without being an expert on default/absent/empty/nil values, I would
have thought that the use case for default values was to save the need
to put them in (an xml document) at all.

Could you please point me to something explaining why it is done this way?

cheers
dim