Re: Specifying Datatype Atoms in Regular Expressions

I'm not a WG member, so the following is just my personal opinion.

Your proposal might be useful, but it has several flaws.

> <!-- declare the datatype using the proposed /x{} syntax -->
> <xsd:simpleType name="Percentage">
>     <xsd:restriction base="xsd:string">
>         <xsd:pattern value="\x{xsd:float}%" />
>     </xsd:restriction>
> </xsd:simpleType>
> <!-- declare an element schema using the Percentage datatype -->
> <xsd:element name="AVCommand">
>   <xsd:complexType>
>     <xsd:attribute name="volume">
>        <xsd:simpleType>
>           <xsd:restriction base="Percentage">
>             <xsd:minInclusive value="12%" />
>             <xsd:maxInclusive value="45%" />
>           </xsd:restriction>
>        </xsd:simpleType>
>     </xsd:attribute>
>   </xsd:complexType>
> </xsd:element>

First of all, since your "Percentage" type is based on "string" type,
rather than "float" type, you can't apply minInclusive/maxInclusive
facets to it. I understand what you want to do, but you can't expect the
validating processors to understand it.

So probably your example should be

<simpleType name="float12-45">
  <restriction base="float">
    <minInclusive value="12" />
    <maxInclusive value="45" />

  <restriction base="string">
    <pattern value="\x{float12-45}%" />

Even so, you can't expect the validating processors to validate things
like (\x{float12-45})+

> I would also expect that any parser worthy of handling regular
> expressions as they are currently defined should be able to extend
> itself to handling this new syntax with a minimum of effort.

This is definitely no. Because it is very difficult to create regular
expression of facet-restricted datatype. I would rather say it's

I'm sorry to say that, but your proposal is unable to implement.


Received on Thursday, 29 March 2001 16:17:46 UTC