Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: George Cristian Bina <george@---------.--->
To: Eliot Kimber <ekimber@---------------.--->
Date: 9/9/2005 4:42:00 PM
Hi Eliot,

I think that Xerces is right here.

The extended type has an empty effective content which means that its 
content type property is the same as the one of the base type, see the 
rules for computing the content type for complex types with complex conte=
nt:
http://www.w3.org/TR/xmlschema-1/#Complex_Type_Definition_details
***
3.2 If the <extension> alternative is chosen, then  the appropriate case 
among the following:
3.2.1 If the =C2=B7effective content=C2=B7 is empty, then the {content ty=
pe} of 
the type definition =C2=B7resolved=C2=B7 to by the =C2=B7actual value=C2=B7=
 of the base 
[attribute]
***

You can see that if you add a particle in the extended type
<xs:element name="an-element">
   <xs:complexType>
     <xs:complexContent>
       <xs:extension base="SomeType">
	<xs:sequence>
	  <xs:element name="test"/>
	</xs:sequence>
         <xs:attribute name="newatt" type="xs:string"/>
       </xs:extension>
     </xs:complexContent>
   </xs:complexType>
</xs:element>

Xerces will also corectly report that:

SystemID: E:\workspace\oXygen\test.xsd
Location: 13:34
Description: E cos-ct-extends.1.4.3.2.2.1.a: The content type of a 
derived type and that of its base must both be mixed or both be 
element-only. Type '#AnonType_an-element' is element only, but its base 
type is not.
URL: http://www.w3.org/TR/xmlschema-1/#cos-ct-extends

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
www.---.com


Eliot Kimber wrote:
> 
> 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 o=
f 
> 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 typ=
e 
> 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

From mike@s... Fri Sep 09 11:31:52 2005
Received: from lisa.w3.org ([128.30.52.41])
	by frink.w3.org with esmtp (Exim 4.50)
	id 1ED


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent