Re: Regular expressions

Except for the syntax, schema content models are essentially regular 
expressions over element names:

(A|B) ==> <xsd:choice>
(A,B) ==> <xsd:sequence>
A* = <element ref="A" minOccurs="0" maxOccurs="unbounded"/>
A+= <element ref="A" minOccurs="1" maxOccurs="unbounded"/>
(A|B)* ==> <xsd:choice minOccurs="0" maxOccurs="unbounded">

This is not an accident.  Schemas are designed as regular expressions, and 
have a heritage in DTDs, which are regular expressions.  The schema WG 
considered the Kleene operators (e.g. *, +) and decided instead on on the 
syntax you see above.   So, I think schemas already have the function that 
you are requesting.  Thank you.

------------------------------------------------------------------
Noah Mendelsohn                              Voice: 1-617-693-4036
IBM Corporation                                Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
------------------------------------------------------------------







Michael Nahas <mike_nahas@yahoo.com> (by way of "C. M. Sperberg-McQueen" 
<cmsmcq
Sent by: www-xml-schema-comments-request@w3.org
07/29/2002 05:59 PM

 
        To:     W3C XML Schema Comments list <www-xml-schema-comments@w3.org>
        cc:     (bcc: Noah Mendelsohn/Cambridge/IBM)
        Subject:        Regular expressions






Sir or Madam:
                 I'd like if the next XML Schema spec had a clear 
relationship to regular 
expressions. I (and a lot of other people) know and understand regular 
expressions.  They're well known by the parsing community.  So, I'd love 
it 
if the new spec contained things that had a relationship to +, *, ?, |, 
().  I suggest tag names of"atLeastOne" "anyNumber" "optionally", 
"chooseOne", and "grouping".
                 So you might end up with something like this:

<element name="element">
                 <chooseOne>
                                 <element name="isOfType>
                                                 <attribute name="type" 
value="string">
                                 </element>
                                 <grouping>
                                                 <optionally>
                                                                 <element 
name="extendsType>
  <attribute name="type" value="string">
 </element>
                                                 </optionally>
                                                 <anyNumber>
                                                                 <element 
name="attribute>
  <attribute name="name" value="string">
  <attribute name="value" value="string>
                                                                 <element>
                                                 </anyNumber>
                                                 <anyNumber>
                                                                 <element 
name="element">
  <attribute name="name" value="string">
 </element>
                                                 </anyNumber>
                                 </grouping>
                 </chooseOne>
</element>

                 I think it is much cleaner than what is currently being 
used in schemas.

                 Michael Nahas

Received on Thursday, 8 August 2002 23:36:46 UTC