users@jaxb.java.net

Re: does jaxb support

From: Mike Gabelmann <mgabelmann_at_shaw.ca>
Date: Fri, 27 Aug 2004 08:54:20 -0700

Ryan Shoemaker - JavaSoft East wrote:

> Mike Gabelmann wrote:
>
>> Does JaxB support the use of default attributes? In the XML schema
>> document you can specify default values for properties. I know that
>> this didnt work in previous version, but is there any indication when
>> they will be used?
>>
>
> I believe we've been supporting this for a long time.
>
> Given an attribute use declaration like:
>
> <xs:attribute name="blarg" type="xs:int" default="242"/>
>
> You should be able to run this:
>
> ObjectFactory of = new ObjectFactory();
> ItemType itm = of.createItemType();
> System.out.println(itm.getBlarg());
>
> and see: 242
>
> Or if the process of unmarshalling doesn't cause that property to
> be set, you would also get the default value.
>
> If you'd like, I can send pointers to the sections of the JAXB spec
> that explain when the defaults apply.
>
>> Also, when creating the XML schema document you can specify
>> enumerations. There does not seem to be anyway to get access to these
>> values in the generated classes. Will there be support for this in
>> the future? It would be nice as otherwise you have to code these
>> interfaces by hand.
>>
>
> Support for this won't be available in the 1.0.x releases, but it
> will be possible in JAXB 2.0 which takes advantage of JDK5 typesafe
> enumerations (which allow you to iterate over the enum values).
>
> Thanks,
>
> --Ryan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>
thanks for your help.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net