users@jaxb.java.net

Re: Customaziation and validation

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Thu, 10 Apr 2003 09:35:58 -0400

> All I am trying to do here is to accept dates in YYYYYMMDD (without the
> '-'s) Is there any other easier way to accept date in different format ?

Then you shouldn't declare its XML type as "xs:date". The YYYYMMDD
format is not a valid value for the xs:date type.

Since you turned on the validation, the JAXB RI assumed that you'd like
your input to be validated against your schema per XML Schema spec,
which rejects YYYYMMDD.

Whether javaType is present or not or whether your converter can handle
values or not are irrelevant for the validation; all it matters is
whether something is valid according to the schema spec.

If you want to accept strings that look like date, then the best you can
do is to use something like xs:token and perhaps use a regexp to make it
tight. Maybe [0-9]{8}?

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