users@jaxb.java.net

Re: How can I specify length constraints?

From: Benson Margulies <bimargulies_at_gmail.com>
Date: Tue, 1 Mar 2011 18:42:54 -0500

David,

JAX-B is not a complete representation of XML Schema. There are many
schema constructs that do not correspond to any @nnotation. If you run
xsd-to-java they get dropped, and of course in the other direction
they never appear.



On Tue, Mar 1, 2011 at 6:30 PM, KARR, DAVID (ATTSI) <dk068x_at_att.com> wrote:
>> -----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?
>