Re: Cutting the Patrician datatype knot

[Pat Hayes]

>
> Yes, Ive come to see that. I simply did not conceive that anything
> could be this badly defined. This aspect of XML datatypes really is a
> crock. It *defines* the domain and range of the datatyping functions
> so that they cannot possibly be the real domains and ranges. What a
> bloody silly thing to do, I'm amazed that Thompson put his name on it.
>

Strangely enough, someone I work with has come up with a perceived need for
exactly this kind of datatype, for use with XML Schema.  The work involves
translating another format into XML, and the datavalues are integers but
they also have mnemonic values.  It is desired to use the mnemonic
(readable) values for XML, but someone wants to be able to use the original
code values if someone wants to do that.  These values come from someone
else's data dictionary and probably can't be changed

Ideally one would like to enforce pairing of the code value and the
mnemonic, so that if you have both they agree (e.g., 1=='west'), but you
can't enforce that with XML Schema.  The fallback position is to allow
either a numeric code value, a string mnemonic, or both, but without
enforcing their correlation (I suggested Schematron but that hasn't been
accepted so far).  The most convenient way seemed to be a union type.  The
correlation is documented an an xsd:annotation element.

I don't know if this approach will survive, but for the time being, there is
this union datatype...

Cheers,

Tom P

Received on Tuesday, 4 December 2001 01:38:34 UTC