[xsd-users] xsd:decimal and fractation digits
Tolonen, Petteri
petteri.tolonen at logica.com
Thu Jun 26 06:38:58 EDT 2008
Hi,
My problem is too many decimal digits in decimal fields.
When fractation digits will be supported?
Part of my schema:
<xsd:complexType name="QuantityType">
<xsd:sequence>
<xsd:element name="Quantity">
<xsd:simpleType>
<xsd:restriction base="xsd:decimal">
<xsd:totalDigits value="10" />
<xsd:fractionDigits value="2" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="QuantityUoM" type="UoMType" />
</xsd:sequence>
</xsd:complexType>
I'll set Quantity to 213.23 and result aint what i am looking for.
Result:
<Quantity>
<Quantity>213.22999999999999</Quantity>
<QuantityUoM>kg</QuantityUoM>
</Quantity>
As i readed posts, i run in to this
http://codesynthesis.com/pipermail/xsd-users/2007-September/001215.html
Should i try to make custom decimal type or should i make custon type from Quantity with decimal truncation?
What if there will be more xsd:desimal elements with different amount of fractation digits.
And does it have effect that Quantity's parent element is also Quantity?
For note: I can't make changes to schema.
An another thing, i tried to read back the generated xml and i'll get
these errors for every element:
error: Element 'Quantity' should be un-qualified
Sample xml:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<GI xmlns="MYOWNNAMESPACE" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="MYOWNNAMESPACE MYXSDFILE.xsd">
...
<Quantity>213.22999999999999</Quantity>
...
<GI/>
Petteri Tolonen
More information about the xsd-users
mailing list