users@jaxb.java.net

Re: Setting required and default values for attribute

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Fri, 24 Jul 2009 15:19:46 +0200

On Fri, Jul 24, 2009 at 2:38 PM, Vladimir Blagojevic <dovlex_at_gmail.com>wrote:

> Hi,
>
> Is there a way to force schema generator not to attach use="required" for
> every attribute of primitive type except of course to use Java primitive
> wrappers?


Try the annotation
  @XmlAttribute( required="false" )


How can we specify default values for attributes so they can be reflected in
> generated schema?
>

No way. But if you go from Java to schema, your Java code would have to
implement the default anyway.
-W


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