<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>5932</bug_id>
          
          <creation_ts>2008-08-06 13:31:06 +0000</creation_ts>
          <short_desc>Open content with empty content models</short_desc>
          <delta_ts>2008-08-06 13:35:36 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XML Schema</product>
          <component>Structures: XSD Part 1</component>
          <version>1.1 only</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Kay">mike</reporter>
          <assigned_to name="C. M. Sperberg-McQueen">cmsmcq</assigned_to>
          
          
          <qa_contact name="XML Schema comments list">www-xml-schema-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>21447</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2008-08-06 13:31:06 +0000</bug_when>
    <thetext>Consider:

&lt;xs:complexType name=&quot;e&quot;&gt;
  &lt;xs:openContent&gt;
    &lt;xs:any namespace=&quot;http://wild.com/&quot;/&gt;
  &lt;/xs:openContent&gt;
  &lt;xs:sequence/&gt;
&lt;/xs:complexType&gt;

Working through the rules in 3.4.2.3.3:

1. The effective mixed is false

2. The explicit content is empty

3. The effective content is empty

4. The explicit content type is: (variety=empty, particle=absent, open-content=absent, simple-type-definition=absent)

5. the wildcard-element is the openContent element

6. Therefore the {content type} property is (variety=empty, particle=&lt;sequence/&gt;, open-content=(&lt;xs:any/&gt;, interleave), simple-type-definition=absent)

So the rules seem to go to some lengths to ensure that the {content type} includes the open content. This would be even more true if the open content were derived from a &lt;defaultOpenContent&gt; with appliesToEmpty=true.

But now look at the validation rules in 3.4.4.2. Rule 1 is:

1.1 If T.{content type}.{variety} = empty, then E has no character or element information item [children].

That is, it doesn&apos;t make any difference what {content type}.{open content} says, the element is only valid if there are no children. Only if {variety} is mixed or element-only do we invoke Element Sequence Locally Valid (Complex Content) (§3.4.4.3), which is where {open content} comes into play.

I find it hard to believe this was intended, especially given the attribute appliesToEmpty.

Also it seems we have carefully constructed a complexType schema component that violates the constraint in 3.4.6.1:

5  If {content type}.{open content} is ·non-absent·, then {content type}.{variety}  is either element-only  or mixed.

I&apos;m not sure what the right fix is. It might be to make variety=element-only in this case. But this would also have effects on deriving types by extension, and I haven&apos;t begun to study in detail what happens when types with open content are extended. 

(Incidentally, another consequence of the current rules is that a defaultOpenContent applies to 

&lt;xs:complexType name=&quot;e&quot; mixed=&quot;true&quot;&gt;
  &lt;xs:sequence/&gt;
&lt;/xs:complexType&gt; 

whether or not it specifies appliesToEmpty=&quot;true&quot;. I don&apos;t know if this was the intention. But it does no harm.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>21448</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2008-08-06 13:35:36 +0000</bug_when>
    <thetext>Ah, shucks. All that work and I took a wrong turning in rule 6.3 of 3.4.2.3.3 which does indeed change the {variety} to element-only. Forget it.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>