union(?) question

first of all, forgive me if this shows up twice.  i
tried to send it once (from a different email address)
hours ago, but i haven't seen it appear yet.  so...

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

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

Received on Tuesday, 4 June 2002 21:20:18 UTC