[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Combining float/string to specify value/units
- From: Eddie Robertsson <email@example.com>
- To: Steve.Rosenberry@ElectronicSolutionsCo.com
- Date: Mon, 26 Mar 2001 18:07:54 +1000
> As for the RE pattern, any ideas where I can find one already defined
> for a float number? Despite my previous assertion of an application
> fully under my control, I'd like to make sure my patterns match the
> official XML Schema functionality as much as possible including the INF,
> NaN, and the exponential notations.
> Is the concept of using primitive datatypes in RE pattern matching
> encoding under consideration for future versions of XML Schema? It
> seems inefficient not to be able to reuse all those wonderful built-in
> validation rules even if they may only be useful when restricting a
> string-based derived datatype.
This may be a long shot by I think this is a valid solution which could help you.
First define a type with all your different datatypes. E.g
<!-- Add whatever else types you want -->
Then create a union datatype that is a union between myTypes and xsd:float.
<xsd:union memberTypes="xsd:float myTypes"/>
If you create an element of this type you can have values of type "23.45", "12"
(any float), "msecs", "mins" etc. Now create a list type of your defined union
and finally restrict the list type to only contain 2 elements.
An element (or attribute) declared using my2List as type should have content like
"23.34 msecs", "12 mins" etc. The only problem is that "mins msecs", "mins 12",
"12.3 23" will also be valid but maybe that's ok?