[xsd-users] XSD Serialization for decimal field type

Zhijie Wang zwang at liquidcapital.com
Mon Apr 1 06:06:53 EDT 2013


Hello,

I'm trying codesyntehsis xsd utility for the first time.   I fill the one field of the  C++ class code Gened by XSD  with decimal type: 1594.8 then I serialize the class to xml string, the decimal field became to 1594.800000000000182.

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?

The field schema definition as below:
<xs:simpleType name="Price">
        <xs:annotation>
            <xs:documentation>
                 float field representing a price. Note the number of decimal places may vary. For certain asset classes prices may be negative values.
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:decimal"/>
</xs:simpleType>

Thanks
Best regards,
Zhijie
Liquid Capital Software Consulting (Chengdu) Co., Ltd
Office Line: +86 28 6633 8890 ext.205




Liquid Capital Australia Pty Limited is registered with the Australian Securities and Investment Commission and located in Australia. 
Liquid Capital Markets Hong Kong Limited is registered with the Securities and Futures Commission in Hong Kong and
located in Hong Kong. 
Liquid Capital Investments Hong Kong Limited and Liquid Capital Securities Hong Kong Limited are registered and located in Hong Kong. 
For more information about these companies, please contact + 61 2 8231 1159.

Please click this <a href=http://www.liquidcapital.com/group/index.php?
location=/web/General/Disclaimer>link</a> for terms relating to all email correspondence.



More information about the xsd-users mailing list