RE: union(?) question

I have worked extensively with this and will offer a word of caution.
What you are doing I think will work in most parsers.  The gottcha I
found was with a union of unions.  Almost all parsers are happy with a
snip like this one, the big exception is msxml4sp1.  I have posted this
on the msxmldev list along with another person who had this issue.

     <xsd:simpleType name="TypeOne">
         <xsd:restriction base="xsd:string">
            <xsd:enumeration value="Value1"/>
            <xsd:enumeration value="Value2"/>
         </xsd:restriction>
      </xsd:simpleType>

     <xsd:simpleType name="TypeTwo">
         <xsd:restriction base="xsd:string">
            <xsd:enumeration value="Value3"/>
            <xsd:enumeration value="Value4"/>
         </xsd:restriction>
      </xsd:simpleType>


     <xsd:simpleType name="TypeThree">
         <xsd:restriction base="xsd:string">
            <xsd:enumeration value="Value5"/>
            <xsd:enumeration value="Value6"/>
         </xsd:restriction>
      </xsd:simpleType>

      <xsd:simpleType name="TypeFour">
         <xsd:union memberTypes="TypeOne TypeTwo"/>
      </xsd:simpleType>

      <xsd:simpleType name="TypeFive">
         <xsd:union memberTypes="TypeFour  TypeThree"/>
      </xsd:simpleType>

This last type will validate in most parsers, except msxml4sp1.  (My
apologies for a poor example here - typos and all - but I think you get
the point).

  


-----Original Message-----
From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org]
On Behalf Of Biron,Paul V
Sent: Tuesday, June 04, 2002 8:45 PM
To: 'Doug'; xmlschema-dev@w3.org
Subject: RE: union(?) question


> -----Original Message-----
> From:	Doug [SMTP:ummmmm22@yahoo.com]
> Sent:	Tuesday, June 04, 2002 6:20 PM
> To:	xmlschema-dev@w3.org
> Subject:	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.
> 
> 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>
> 
that's exactly how you'd do it.

pvb

Received on Wednesday, 5 June 2002 12:24:16 UTC