users@jaxb.java.net

Re: Custom validation

From: Marcus Walls <marcus.walls_at_ASPECTIVE.COM>
Date: Wed, 15 Jan 2003 04:20:48 -0700

> There's no "string validation routine". Validation is just not
> implemented in that way. JAXB RI will guarantee that the string
> will be validated against the schema *before* it gets passed to
> your parse method, but you can't use those code as a sub-routine.

Hmm... maybe I'm confused.

I would like to define my own string type, but still be able to
take advantage of the length validation and pattern matching
capabilities. However, in effect my new string type is changing
the definition of the "length" attribute, and therefore the
validation will be applied against the actual string rather than
against the parsed string.

This (probably naively) sounds like quite a limitation.

If I want to create my own type completely (probably based upon
string) presumably I would have to define my own "maxLength" etc
properties. How would my validation method reference these
properties?

Since I'm very new to all this, I don't have a clear picture
of what is done in the "schema", what is done by JAXB and how
the validation process works. And I probably don't really know
which questions to ask!

Marcus