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

RE: union(?) question

From: Paul Kiel <paul@hr-xml.org>
Date: Wed, 5 Jun 2002 11:44:19 -0400 (EDT)
To: "'Biron,Paul V'" <Paul.V.Biron@kp.org>, "'Doug'" <ummmmm22@yahoo.com>, <xmlschema-dev@w3.org>
Message-ID: <000a01c20ca7$b4b24950$6401a8c0@paul>

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:simpleType name="TypeTwo">
         <xsd:restriction base="xsd:string">
            <xsd:enumeration value="Value3"/>
            <xsd:enumeration value="Value4"/>

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

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

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

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.

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

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