W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2002

Re: how does one represent an alternating set of elements?

From: Steve Baker <sjb@sphinx.mythic-beasts.com>
Date: Sat, 16 Feb 2002 10:30:36 -0500 (EST)
To: John Utz <utz@singingfish.com>
cc: <xmlschema-dev@w3.org>
Message-ID: <Pine.LNX.4.33.0202161256420.31526-100000@sphinx.mythic-beasts.com>
Dear John

This schema represents the structure you require and passes XSV:

<?xml version = "1.0" encoding = "UTF-8"?>
<xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema">

  <xsd:element name='A' type='xsd:anyType'/>
  <xsd:element name='B' type='xsd:anyType'/>

  <xsd:element name='seqAB'>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:group ref='seqABgroup' minOccurs='0' maxOccurs='unbounded'/>
        <xsd:element ref='A' minOccurs='0'/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

  <xsd:group name='seqABgroup'>
    <xsd:all>
        <xsd:element ref='A'/>
        <xsd:element ref='B'/>
    </xsd:all>
  </xsd:group>

</xsd:schema>

HTH

regards

Steve Baker

On Fri, 15 Feb 2002, John Utz wrote:

> greetings;
>
> i hope this is trivial for somebody, it's been an absolute hair puller for
> me and some other people.
>
> i am attempting to describe a set of alternating elements:
>
> so, the valid collections of elements would be
>
> A, AB, ABA, ABAB,....
>
> what would *not* be legal would be:
>
> B, BA, AA, ABB, ABAA, BB,....
>
> any help in describing this would be greatly appreciated!
>
> tnx!
>
> johnu
>
>
Received on Sunday, 17 February 2002 09:14:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:26 GMT