This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 6202 - All group extending "empty mixed" content
Summary: All group extending "empty mixed" content
Status: RESOLVED WONTFIX
Alias: None
Product: XML Schema
Classification: Unclassified
Component: Structures: XSD Part 1 (show other bugs)
Version: 1.1 only
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: C. M. Sperberg-McQueen
QA Contact: XML Schema comments list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-02 20:03 UTC by Michael Kay
Modified: 2008-11-24 15:18 UTC (History)
1 user (show)

See Also:


Attachments

Description Michael Kay 2008-11-02 20:03:44 UTC
As far as I can see, it is valid to do this:

<xs:complexType name="B" mixed="false">
 <xs:all/> <!-- or equivalently <xs:sequence/> -->
</xs:complexType>

<xs:complexType name="E" mixed="false">
 <xs:complexContent>
  <xs:extension base="B">
   <xs:all>
    <xs:element name="P"/>
    <xs:element name="Q"/>
   </xs:all>
  </xs:extension>
 </xs:complexContent>
</xs:complexType>

But it becomes invalid if both the mixed attributes are changed to mixed="true". In the former case, xs:all extending empty is allowed. But in the latter case, the variety of B is mixed, with content type being an empty group with compositor = sequence. The extension will then be constructed with a content model of

<sequence>
  <sequence/>
  <all>
    <xs:element name="P"/>
    <xs:element name="Q"/>
  </all>
</sequence>

which is not valid under 3.8.6.2 All Group Limited.

The underlying problem here is that the varieties (empty, mixed, element-only, simple) are not fully orthogonal. Really there should be two orthogonal boolean properties: can-contain-elements and can-contain-text. But short of a radical remodelling, I think it can be fixed by changing 3.4.2.3.3 clause 4.2.3.2 from 

"4.2.3.2 If the {term} of the ·base particle· has {compositor}  all and the {term} of the ·effective content· also has {compositor}  all, ..."

 to 

"4.2.3.2 If the {term} of the ·effective content· has {compositor}  all and one of the following conditions is true: 

4.3.2.3.1 the {term} of the ·base particle· also has {compositor}  all,

4.3.2.3.2 the {term} of the ·base particle· is a model group whose {compositor} is sequence and whose {particles} is empty, ....

(alternatively, introduce a new case into the 4.3.2.x list)
Comment 1 Michael Kay 2008-11-05 11:58:21 UTC
It might also be worth observing that although the XML mapping rules never generate a model group whose {compositor} is *all* and whose {particles} is empty, the schema component model allows such a model group to exist. It generally seems a bad idea to allow components to exist for which there is no XML representation.

(HT has pointed out another case, the component model does not prevent an *all* group containing particles other than element particles and wildcard particles.)

On a related point, a singleton *sequence* and a singleton *all* model group are equivalent from the point of view of validation, and from the point of view of the rules on valid restriction; but they are not equivalent when it comes to derivation by extension. (If operator syntax is used, as in (A,B) for sequence or (A&B) for interleave, it becomes clear that for singleton groups there should be no distinction.) Should we make them equivalent in the component model, or at least allow both to be extended in the same ways?
Comment 2 David Ezell 2008-11-24 15:18:57 UTC
Telcon 2008-11-21
Status quo:
If you have something truly empty, you can go to anything; mixed or not.
If you have something which is mixed but allows no element children, you
can go to sequence and mixed, and choice and mixed, but not to all and
mixed.

MSM's instinct is to fix non-orthogonality by removing the special-case
for all, which is probably too much trouble right now. Don't like
repairing non-orthogonality by adding more special rules.

MK: One thing we could do is remove special case for empty all, which
removes that point of non-orthogonality.
MSM: Could then just replace rules that appeal to empty sequence to
apply to empty all as well.
MK: But variety empty=empty sequence.

SG: Think there is no real problem here. Think any change is risky.

Agreement, or acceptance of this view.