Hi Don,
Yes, that's the required behaviour of extension. According to 3.4.2 of the XML Schema: Structures Recommendation [1] the model group of a complex type with complex content derived by extension is "sequence and whose {particles} are the particle of the {content type} of the type definition resolved to by the actual value of the base [attribute] followed by the explicit content."
In other words, it's a sequence of the content of ChoiceType followed by a choice consisting of the single element, Third.
Thanks,
Henry
[1] http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-complexContent::extension
------------------------------------------------------------------------
Henry Zongaro XML Parsers development
IBM SWS Toronto Lab Tie Line 969-6044; Phone (905) 413-6044
mailto:[EMAIL PROTECTED]
Please respond to [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
cc:
Subject: Extending Choice Model Groups
Hi guys
I just wanted to get your take on the extension of Choices. In the below example I extend a choice model group with another choice, but the extended choice element acts as if it is a sequence model group.
This is the error message
[Error] choice.xml:9:13: The content of element type "myChoice" must match "((First|Second),Third)"
Is this the correct behaviour according to the XSDL Spec ?
Thanks in advance.
Don O'Leary
Below is the Schema and Instance.
==================================
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://choice.org"
elementFormDefault="qualified">
<xsd:complexType name="ChoiceType">
<xsd:choice>
<xsd:element name="First" type="xsd:string"/>
<xsd:element name="Second" type="xsd:string"/>
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="ExtendedChoiceType">
<xsd:complexContent>
<xsd:extension base="ChoiceType">
<xsd:choice>
<xsd:element name="Third" type="xsd:string"/>
</xsd:choice>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="myChoice" type="ExtendedChoiceType"/>
</xsd:schema>
=================================
<?xml version="1.0" encoding="UTF-8"?>
<myChoice xmlns="http://choice.org"
xsi:schemaLocation="http://choice.org choice.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Third>String content</Third>
</myChoice>
