Restricting xml schema datatypes by relation?.

G

goldfrapper

H,

If have been searching for a while, without finding, for a way to
restrict a datatype from a certain basetype by relation instead of
strict restriction.

For example: (in the metric system) to relate a datatype named kilogram
to gram or liter to mililiter.

This would make it possible to move between related datatypes.

Say where given a two values: 1.5 kilogram and 500 gram and we need to
count them as one value.
If we would 'know' that 1000 gram is equal to 1 kilogram we could do
the math.

This could be done by optional facets like:

<xs:simpleType name="gram">
<xs:restriction base="xs:decimal"></xs:restriction>
</xs:simpleType>

<xs:simpleType name="kilogram">
<xs:restriction base="xs:gram">
<xs:scale fixed="true" value="1:1000" />
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="miligram">
<xs:restriction base="xs:gram">
<xs:scale fixed="true" value="1000:1" />
</xs:restriction>
</xs:simpleType>

Is there any standardized way to do this yet?

Tom Van de Putte.
 

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

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top