users@jaxb.java.net

Re: How can I specify length constraints?

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Wed, 2 Mar 2011 18:53:31 +0100

It says "[@XmlSchemaType] maps a Java type to a *simple schema built-in *type",
so I'd say: no, it won't work.
-W


On 2 March 2011 17:07, KARR, DAVID (ATTSI) <dk068x_at_att.com> wrote:

> > -----Original Message-----
> > From: KARR, DAVID (ATTSI)
> > Sent: Tuesday, March 01, 2011 3:31 PM
> > To: users_at_jaxb.java.net
> > Subject: RE: How can I specify length constraints?
> >
> > > -----Original Message-----
> > > From: KARR, DAVID (ATTSI)
> > > Sent: Tuesday, March 01, 2011 3:17 PM
> > > To: users_at_jaxb.java.net
> > > Subject: How can I specify length constraints?
> > >
> > > When I write pure XML Schema, I can define a simple type based on
> > > string
> > > that has length restrictions, being a minimum and maximum length. I
> > > don't see a way to do that with JAXB annotations. Assuming I've
> just
> > > missed it, will schemagen respect that annotation in the generated
> > > schema?
> >
> > Is the only reasonable strategy to have a hand-coded "simple types"
> > schema, and to have your JAXB classes reference those types?
>
> After more consideration, I'm not sure I could even get this to work. I
> could use a "@XmlSchemaType" annotation to specify a type that's defined
> in the auxiliary xsd file, and then use either xslt or the xmltask Ant
> library to integrate an xs:import or xs:include into the generated xsd
> file.
>
> Could this work?
>