W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2015

Re: Correct semantics of XML Schema extension with respect to the content models

From: Michael Kay <mike@saxonica.com>
Date: Fri, 9 Oct 2015 15:56:31 +0100
Cc: xmlschema-dev@w3.org
Message-Id: <11234ABF-3DBC-4143-8437-A8799ECCE05C@saxonica.com>
To: timothymarc@freenet.de
Your text has got corrupted in transit, but I think the second interpretation is correct. If the content model of B is X, and C extends B with a content model Y, the the combined content model is sequence(X, Y).

The relevant rule is in XSD 1.1 Part 1 section 3.4.2.3.3 clause 4.2.3.3, which states:

{term} a model group whose {compositor} is sequence and whose {particles} are the ·base particle· followed by the ·effective content·.

Michael Kay
Saxonica


> On 9 Oct 2015, at 08:42, timothymarc@freenet.de wrote:
> 
> Hi all,
> 
> I am struggling with the exact semantics of extension regardingthe derivation of the content model. Please see the following two types:
> 
>       xs:complexType name="CT10Sequence">
>              xs:sequence>
>                     xs:element maxOccurs=“3" name=“e1" type="tns:CT1"/>
>              xs:sequence>
>       xs:complexType>
> 
>       xs:complexType name="CT11Sequence">
>              xs:complexContent>
>                     xs:extension base="tns:CT10Sequence">
>                           xs:choice>
>                                  xs:element maxOccurs=“3" name=“e2 "type="tns:CT1"/>
>                           xs:choice>
>                     xs:extension>
>              xs:complexContent>
>       xs:complexType>
> 
> The question that bothers me for quite a long time now is: whichof the following two “virtual” types corresponds to the semantics ofCT11Sequence regarding the content model?
> 
> 1.      The content model of CT11Sequence incorporatesthe content model of CT10Sequence
>       xs:complexType name="CT11Sequence_Derived1">
>              xs:choice>
>                     xs:element maxOccurs=“3" name=“e2" type="tns:CT1"/>
>                            xs:sequence>
>                                   xs:element maxOccurs=“3" name=“e1" type="tns:CT1"/>
>                            xs:sequence>
>              xs:choice>
>       xs:complexType>
> 
> 2.      The content model of CT10Sequence remains onfirst position and incorporates the content model of CTSequence11
>       xs:complexType name="CT11Sequence_Derived2">
>                     xs:sequence>
>                       xs:element maxOccurs=“3” name=“e1" type="tns:CT1"/>
>                       xs:element maxOccurs=“3" name=“e2" type="tns:CT1"/>
>                     xs:choice>
>                  xs:sequence>
>       xs:complexType>
> 
> The difference is substantial, for in the first alternative exclusivelyeither of the elements can appear, whereas in the second alternative element e1and e1 must occur but in the exact order.
> 
> I am grateful for any hint. According to my validator, the second alternative should be the correct interpretation, but I would like to get other expert opinions and maybe also a hint to the XSD spec where this semantics is described.
> 
> 
> Best regards,
> Timothy
>   Normal  0          false  false  false    EN-GB  X-NONE  X-NONE  table.MsoNormalTable	
> 
> 
> 
> ---
> Alle Postfächer an einem Ort. Jetzt wechseln und E-Mail-Adresse mitnehmen! http://email.freenet.de/basic/Informationen
> 
> 
> 
Received on Friday, 9 October 2015 14:56:57 UTC

This archive was generated by hypermail 2.3.1 : Friday, 9 October 2015 14:56:58 UTC