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

RE: all, xs:sequence, and xs:choice

From: Michael Kay <mike@saxonica.com>
Date: Fri, 13 May 2005 09:50:34 +0100
To: "'Xiaofeng Wang'" <wangx49931@yahoo.com>, <xmlschema-dev@w3.org>
Message-ID: <E1DWVsZ-0007DT-AZ@bart.w3.org>

> Hi All,
> 
> I can define a complexType A with a set of elements
> using xs:all, xs:sequence, or xs:choice. I understand
> the difference between them. What confuses me is that
> if I want to define a new complexType B which extends
> complexType A using xs:extension, will xs:all,
> xs:sequence, and xs:choice have different impact on
> the extension?
> 

If the content model of A is MA, then when you define a new type B as an
extension of A, giving it a content model of MB, the combined type is

sequence (MA, MB)

So if A was a choice of A1 or A2, and B is a choice of B1 or B2, the
extended type is

sequence (choice(A1, A2), choice(B1, B2))

This doesn't work with xs:all, which (IIRC) doesn't allow extension.

Michael Kay
http://www.saxonica.com/
Received on Friday, 13 May 2005 08:50:45 GMT

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