[xsd-users] no reaction on XSD_CXX_TREE_DECIMAL_PRECISION
Rizzuto, Raymond
Raymond.Rizzuto at sig.com
Fri Sep 19 16:15:38 EDT 2008
Boris,
I probably will defer that to the next phase of this project. For now, I tested that setting XSD_CXX_TREE_DECIMAL_PRECISION=6 on the command line gave me the results I wanted. It worked beautifully! Instead of 49.04 being output as 49.039999999999999, it is output as 49.04.
Ray
-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com]
Sent: Monday, September 15, 2008 8:36 AM
To: Rizzuto, Raymond
Cc: Gennady Khokhorin; xsd-users at codesynthesis.com
Subject: Re: [xsd-users] no reaction on XSD_CXX_TREE_DECIMAL_PRECISION
Hi Ray,
Rizzuto, Raymond <Raymond.Rizzuto at sig.com> writes:
> Let's say I have a message with two instances of the type (for example,
> a type of temperature, one instance for internal, one for external).
> Each of the two temperatures might have different precision, maybe
> based on the accuracy of the respective temperature sensor. If I
> understand you, my overridden type (for temperature) would need
> an accessor function to allow setting the precision, and the
> serialization logic would use the precision attribute.
Yes, you can certainly implement it this way. Furthermore, the
parsing logic can try to figure out the precision automatically
based, for example, on the number of characters after '.' in the
string representation.
> I asked the author of the schema about specifying fractionDigits
> in the schema, but he was not in favor of that idea. I know I
> could create a modified version of his schema, but that would
> be a maintenance nightmare since the schema has been in flux.
Then you can use type customization to implement the fractionDigits
behavior without having it in the schema. The custom/double example
in 3.2.0 shows how to do something similar for the build-in double
type though you would probably want to customize a user-defined
type (e.g., temperature) which is even easier.
Boris
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
More information about the xsd-users
mailing list