[xsd-users] no reaction on XSD_CXX_TREE_DECIMAL_PRECISION
Boris Kolpackov
boris at codesynthesis.com
Mon Sep 15 08:35:52 EDT 2008
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
More information about the xsd-users
mailing list