[xsde-users] XSDE unable to validate totalDigits restriction in xs:decimal element

S R n.e.x.g.e.n.s at gmail.com
Thu Jun 23 08:09:56 EDT 2022


Thanks Boris.

Is there  a simple way to plug in a regular expression and enforce the
totalDigits/fractionDigits facets rather than having a complete new class
for custom parsing and serialization?

On Wed, Jun 22, 2022 at 10:10 AM Boris Kolpackov <boris at codesynthesis.com>
wrote:

> 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