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

union(?) question

From: doug <i.hate@spam.com>
Date: Tue, 4 Jun 2002 14:05:05 -0400 (EDT)
Message-ID: <3CFD007D.5090402@spam.com>
To: xmlschema-dev@w3.org

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: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:simpleType name="AMEXNumber">
          <xsd:restriction base="xsd:string">
             <xsd:pattern value="34\d{13}"/>
             <xsd:pattern value="37\d{13}"/>

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

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 


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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:57 UTC