users@jaxb.java.net

Re: Jaxb 1.0.1 and defaults values

From: Joe Fialli <Joseph.Fialli_at_sun.com>
Date: Fri, 06 Jun 2003 12:08:30 -0400

Tim Davidson wrote:

>hello people,
>
> I managed to get jaxb 1.0.1 working with my schmas, but it still doesn't appear to be picking up default values from the schma. We are using the jaxb generated classes as a bean on a web site and we require defaults. Is this still a bug? or are the defaults for the generated xml only and not the class itself? can you reccommend a fix?
>
Are you inquiring what happens to a JAXB property that is related to an
XML Schema attribute with a default value?

Lets use the following explicit example that I am assuming summarizes
your situation:

XML Schema fragrment <xs:attribute name="Foo" type="xsd:string"
default="default value"/>

Java Fragrment:
XXX x = (XXX)ObjectFactory.createXXX()
x.getFoo() should return "default value" and you are seeing "" instead.

Additionally, were you looking for element defaulting as well as
attribute defaulting.

-Joe Fialli, Sun Microsystems

>
>regards
>
>
>