[xsd-users] XSD Serialization for decimal field type

Boris Kolpackov boris at codesynthesis.com
Mon Apr 1 07:44:41 EDT 2013


Hi Zhijie,

Zhijie Wang <zwang at liquidcapital.com> writes:

> Seems XSD convert it to the precision of 15 decimal digit. As I want to 
> set it to one decimal digit value, is there a way I can truncate it to 
> 1594.8 for this case?
>
> [...]
>
> <xs:restriction base="xs:decimal"/>

There are several ways to achieve this. The easiest and cleanest is
to specify the fractionDigits facet in the schema. Other options are
to use a macro or to customize the type. See the README file in the
examples/cxx/tree/custom/double example for details.

Boris



More information about the xsd-users mailing list