W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2005

RE: Must You Specify mixed="true" on extended types?

From: Stan Kitsis <skits@microsoft.com>
Date: Thu, 8 Sep 2005 19:49:13 -0700
Message-ID: <2967212019EB7B4D990E06E1AC2F2319048E8B62@RED-MSG-60.redmond.corp.microsoft.com>
To: "Eliot Kimber" <ekimber@innodata-isogen.com>, "xml-schema-dev" <xmlschema-dev@w3.org>

The value for the mixed attribute is not inherited from the base type.
So if the base type sets mixed to true, you need to also specify
mixed="true" for the derived type.

Stan

-----Original Message-----
From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org]
On Behalf Of Eliot Kimber
Sent: Thursday, September 08, 2005 1:51 PM
To: xml-schema-dev
Subject: Must You Specify mixed="true" on extended types?


I have declarations of the form:

<xs:complexType name="SomeType">
   <xs:complexContent mixed="true">
     <xs:sequence>
       <xs:element ref="ns:someElement"/>
     </xs:sequence>
   </xs:complexContent>
</xs:complexType>

<xs:element name="an-element">
   <xs:complexType>
     <xs:complexContent>
       <xs:extension base="SomeType">
         <xs:attribute name="newatt" type="xs:string"/>
       </xs:extension>
     </xs:complexContent>
   </xs:complexType>
</xs:element>

Xerces 2.6 and 2.7 both pass this, as does oXygen (which I believe uses 
Xerces for schema processing). An older version of Stylus Studio throws 
an error, saying that the extended type (an-element) must specify 
mixed="true" or the base type must specify mixed="false".

A reading of "Schema Component Constraint: Derivation Valid (Extension)"

suggests that Stylus is in fact correct:

"1.4.3.2.2.1 Both {content type}s must be mixed or both must be 
element-only."

But I wanted to make sure, because I would have expected the value for 
"mixed" to be inherited from the base type for extensions, regardless of

what the nominal default value of the "mixed=" attribute is.

That is, it feels like "Simon Says" behavior to have to specify 
mixed="true" for extensions when the base complex type specifies 
mixed="true". Obviously, specifying mixed="false" when the base type 
specifies mixed="true" would be an error. But if the extending type 
specifies nothing for mixed, it should reflect the value specified for 
the base type.

Also, if this is required by the spec, then Xerces appears to not be 
validating it all, because in my tests it didn't catch the case where 
two declarations explicitly disagree on the value for mixed=.

Thanks,

Eliot
-- 
W. Eliot Kimber
Professional Services
Innodata Isogen
9390 Research Blvd, #410
Austin, TX 78759
(512) 372-8155

ekimber@innodata-isogen.com
www.innodata-isogen.com
Received on Friday, 9 September 2005 02:49:22 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:50 GMT