This is admittedly not the most critical problem, but I recently came
across this issue for schemas that had a pattern applied to a double, as
so:

> <xsd:simpleType name ="TEST">
>       <xsd:restriction base="xsd:double">
>               <xsd:pattern value="(\+|\-)?\d{0,8}(\.\d{0,6})?"/>
>       </xsd:restriction>
> </xsd:simpleType>


When the instance passed in a number like 123456.123456, it validated
just fine, but when a larger valid number like 12345678.123456 was
passed in, the instance did not validate.

The problem has to do with scientific notation.  The code turns this
input value into a double and then validates that against the facets. 
To validate against the given pattern, the class DoubleValidator (which
extends PatternValidator) does this:

>         if (hasPattern())
>             super.validate(Double.toString(d), context);


The toString method, according to documentation, will represent any
number >10**7 or < 10**-3 in scientific notation.  12345678.123456 is
past the threshold, and will be represented in scientific notation,
which will not match the given pattern.  A valid number is therefore
found to be invalid.

Lisa

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to