When fractionDigits and totalDigits won't do the job (?)

V

Vegard Bakke

I would like to specicy a type that restricts decimal numbers to a
maximum of 15+2 digits. (Up to 15 digits before the decimal point and
2 after.)

I'll use an example of 3+2 for simplicity.

<xs:simpleType name="AmountType">
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="2"/>
<xs:totalDigits value="5"/>
</xs:restriction>
</xs:simpleType>

This will allow <A>999.99</A> and will prohibit <A>999.999</A> and
<A>9999.99</A>.

However it also allows <A>9999.9</A> and <A>99999</A> (XMLSpy 2004),
which is not what I want.

Am I forced to use maxExclusive=1000? Which means, is:
<xs:fractionDigits value="2"/>
<xs:maxExclusive value="1000000000000000"/>
the only way to restrict a decimal data type to 15+2?

It is quite error prone and hard to read (count).

Cheers,
Ve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top