users@jaxb.java.net

Re: max length field validations

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Sat, 14 Feb 2009 10:51:14 +0100

Sorry, no, JAXB doesn't check any facets. "Required" is different. But if
you annotate existing Java classes, you can check lengths in the set method.
-W

On Sat, Feb 14, 2009 at 9:41 AM, arun_rocky
<arunkumaravel.d_at_cognizant.com>wrote:

>
> hi wolfgang,
>
> i like to add these commands in Java beans. for requirement = true i am
> using @XmlElement(required=true), so do we have any commands like this for
> checking maxLength and minLength of an element. thanks in advance mate..
>
>
>
>
> Wolfgang Laun-2 wrote:
> >
> > You can define a simpleType like this:
> >
> > <xsd:simpleType name="ShortNameType">
> > <xsd:restriction base="xsd:string">
> > <xsd:minLength value="1"/>
> > <xsd:maxLength value="3"/>
> > </xsd:restriction>
> > </xsd:simpleType>
> >
> > It'll still result in java.lang.String, just like xsd:String. Only
> > validation will check your XML's compliance with the min/maxLength
> facets.
> >
> > -W
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/max-length-field-validations-tp22010264p22010383.html
> Sent from the java.net - jaxb users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>