users@jaxb.java.net

RE: How can I specify length constraints?

From: KARR, DAVID (ATTSI) <"KARR,>
Date: Wed, 2 Mar 2011 08:07:33 -0800

> -----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?