[xsde-users] XSDE unable to validate totalDigits restriction in
xs:decimal element
Boris Kolpackov
boris at codesynthesis.com
Wed Jun 22 10:09:56 EDT 2022
S R <n.e.x.g.e.n.s at gmail.com> writes:
> <xs:simpleType name="amount">
> <xs:restriction base="xs:decimal">
> <xs:minInclusive value="0"/>
> <xs:fractionDigits value="5"/>
> <xs:totalDigits value="18"/>
> </xs:restriction>
> </xs:simpleType>
>
> Our test case has this tag value as
> <amount>6248245166124111525.</amount>
>
> This amount should fail parsing validation because of 19 total digits,
> where allowed is only 18 total digits. But there is no parsing exception
> thrown. The above value is successfully accepted.
XSD/e validates only the commonly-used subset of the XML Schema facets,
as documented in these Appendices:
https://codesynthesis.com/projects/xsde/documentation/cxx/parser/guide/#A
https://codesynthesis.com/projects/xsde/documentation/cxx/serializer/guide/#A
For decimal, these are min/maxExclusive and min/maxInclusive.
You can, however, provide a custom parser and/or serializer implementation
for your type that performs any additional validation, as described in
"Customizing Parsers and Serializers":
https://codesynthesis.com/projects/xsde/documentation/cxx/hybrid/guide/#6.1
More information about the xsde-users
mailing list