union(?) question

i'm trying to define 4 custom, named simpleTypes, each a restriction of 
xsd:string, then combine them into a named type that allows any one of 
those simpleType formats.

initial simpleTypes:

       <xsd:simpleType name="VisaNumber">
          <xsd:restriction base="xsd:string">
             <xsd:pattern value="4\d{15}"/>
             <xsd:pattern value="4\d{12}"/>
          </xsd:restriction>
       </xsd:simpleType>

       <xsd:simpleType name="MasterCardNumber">
          <xsd:restriction base="xsd:string">
             <xsd:pattern value="51\d{14}"/>
             <xsd:pattern value="52\d{14}"/>
             <xsd:pattern value="53\d{14}"/>
             <xsd:pattern value="54\d{14}"/>
             <xsd:pattern value="55\d{14}"/>
          </xsd:restriction>
       </xsd:simpleType>

       <xsd:simpleType name="AMEXNumber">
          <xsd:restriction base="xsd:string">
             <xsd:pattern value="34\d{13}"/>
             <xsd:pattern value="37\d{13}"/>
          </xsd:restriction>
       </xsd:simpleType>

       <xsd:simpleType name="DiscoverNumber">
          <xsd:restriction base="xsd:string">
             <xsd:pattern value="6011\d{12}"/>
          </xsd:restriction>
       </xsd:simpleType>

i'm very new to XML Schema, and the only thing i could come up with that 
seems promising is "union".  so... would this syntax do the trick?  is 
there a better way?

       <xsd:simpleType name="AcceptedCreditCards">
          <xsd:union memberTypes="VisaNumber MasterCardNumber AMEXNumber 
DiscoverNumber"/>
       </xsd:simpleType>

thanks.

b.r.e.a.u.x at c.l.e.a.r.l.a.k.e dot i.b.m dot c.o.m

Received on Wednesday, 5 June 2002 03:20:56 UTC