users@jaxb.java.net

Re: Custom validation

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 14 Jan 2003 16:12:22 -0800

> I'd like the validation of the type to be able to call
> the validation method of the base-type.
>
> i.e. in my example of trimming strings, I'd like to be
> able to trim the string and then call the string validation
> routine, safe in the knowledge that the maxLength etc
> elements could still be used to configure the validation.
>
> Is this possible?

No. 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.

What you can do, though, is to check your constraint by yourself in both
the parse and the print methods. In your case, hopefully that won't be
too much work.


regards,
--
Kohsuke KAWAGUCHI                  408-276-7063 (x17063)
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com