You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "O'Leary, Don" <Do...@commerceone.com> on 2001/10/03 20:46:59 UTC

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>