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

using xsd:choice + element value

From: Matt Long <mlong@phalanxsys.com>
Date: Fri, 24 May 2002 07:10:14 -0500
To: <xmlschema-dev@w3.org>
Message-ID: <000001c2031b$f98cf4c0$3cfff6d0@gulag>
Question,
 
Is it possible to utilize 'choice' from an element value (not purely the
existence of the element name)
Example: a schema with a qualifier (1=person, 2=place)  .so the question
is how can one determine the group ref from the element value of
'qualifier' element (or is it simply not possible)?
 
-Matt Long
Phalanx Systems, LLC
 
<xsd:element name="whatIsIt" type="z:infoType"/>
 
<xsd:complexType name="infoType">
            <xsd:sequence>
<xsd:element name="qualifier" type="z:myQualType"/>
<!-how can 'qualifier' qualify the choice of group reference -->
<xsd:choice>
                                    <xsd:group ref="z:personGroup"/>
                                    <xsd:group ref="z:placeGroup"/>
</xsd:choice>
            </xsd:sequence>
</xsd:complexType>
 
<xsd:group name="personGroup">
            <xsd:sequence>
                        <xsd:element name="firstName"
type="xsd:string"/>
                        <xsd:element name="lastName" type="xsd:string"/>
            </xsd:sequence>
</xsd:group>
 
<xsd:group name="placeGroup">
            <xsd:sequence>
                        <xsd:element name="country" type="xsd:string"/>
                        <xsd:element name="city" type="xsd:string"/>
            </xsd:sequence>
</xsd:group>
 
<xsd:simpleType name="myQualType">
            <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="1"/>
                        <xsd:enumeration value="2"/>
            </xsd:restriction>
</xsd:simpleType>
 
Received on Friday, 24 May 2002 08:40:40 UTC

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