W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > January to March 2001

Re: Specifying Datatype Atoms in Regular Expressions

From: Kohsuke KAWAGUCHI <k-kawa@bigfoot.com>
Date: Thu, 29 Mar 2001 13:18:09 -0800
To: www-xml-schema-comments@w3.org
Message-Id: <20010329130101.6747.K-KAWA@bigfoot.com>

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>
</simpleType>

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


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
impossible.

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


regards,
----------------------
K.Kawaguchi
E-Mail: k-kawa@bigfoot.com
Received on Thursday, 29 March 2001 16:17:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:50 GMT