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

xs:choice problem

From: Laurent Chaply <lchaply@imrglobal.fr>
Date: Wed, 10 Apr 2002 09:59:06 -0400 (EDT)
Message-ID: <3cb44508$1@www.sonicsoftware.com>
To: xmlschema-dev@w3.org


I have a problem using xs:choice with the same element name but with different

exemple :
<xs:element name="E0">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="E1" type="T1"/>
      <xs:element name="E2" type="T2"/>
T1, T2 and T3 are complexTypes derived from the same type


<xs:complexType name="T0"/>

<xs:complexType name="T1">
    <xs:extension base="T0">
        <xs:element name="A" type="xs:string"/>

<xs:complexType name="T2">
    <xs:extension base="T0">
        <xs:element name="B" type="xs:string"/>

I want to ensure that the E1 element's type is one the two types T1 et T2

I'm using XMLSpy to validate my documents and schemas
the schema is correct but the following instance document do not pass validation.

    <A>a string</A>

The validator tells me a <B> tag is expected

Has anybody an idea to explain how this example is processed by the validator,
and if there is another solution to do the same thing. I can't use "xsi:type"
because I'm creating XML Schemas from existing XML documents.

Thanks for your help
Received on Monday, 15 April 2002 06:24:03 UTC

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