<?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>16786</bug_id>
          
          <creation_ts>2012-04-18 18:05:18 +0000</creation_ts>
          <short_desc>S4S does not allow openContent without group in complex type restriction</short_desc>
          <delta_ts>2015-05-23 18:59:56 +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>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>resolved</keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Priscilla Walmsley">pwalmsley</reporter>
          <assigned_to name="David Ezell">David_E3</assigned_to>
          <cc>cmsmcq</cc>
    
    <cc>mike</cc>
          
          <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>66809</commentid>
    <comment_count>0</comment_count>
    <who name="Priscilla Walmsley">pwalmsley</who>
    <bug_when>2012-04-18 18:05:18 +0000</bug_when>
    <thetext>The Schema for Schemas does not allow a complex content restriction where an openContent is specified without a group/all/choice/sequence.  It is legal to restrict away the entire content model (if everything is optional), so why should you not be able to specify this:

  &lt;xs:complexType name=&quot;ProductType&quot;&gt;
    &lt;xs:openContent&gt;
      &lt;xs:any namespace=&quot;##any&quot;/&gt;
    &lt;/xs:openContent&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name=&quot;child1&quot; type=&quot;xs:string&quot; minOccurs=&quot;0&quot;/&gt;
    &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;

  &lt;xs:complexType name=&quot;RestrictedProductType&quot;&gt;
    &lt;xs:complexContent&gt;
      &lt;xs:restriction base=&quot;ProductType&quot;&gt;
        &lt;xs:openContent&gt;
          &lt;xs:any namespace=&quot;##other&quot;/&gt;
        &lt;/xs:openContent&gt;
      &lt;/xs:restriction&gt;
    &lt;/xs:complexContent&gt;
  &lt;/xs:complexType&gt;

A corner case, to be sure, but it seems like it should be a legal restriction, and the Schema for Schemas considers this invalid.

(Incidentally the Schema for Schemas differs slightly from the XML Representation Summary in 3.4.2.3 in this regard.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66898</commentid>
    <comment_count>1</comment_count>
    <who name="C. M. Sperberg-McQueen">cmsmcq</who>
    <bug_when>2012-04-20 16:34:32 +0000</bug_when>
    <thetext>Not verified, but I think it should work if you write

  &lt;xs:complexType name=&quot;RestrictedProductType&quot;&gt;
    &lt;xs:complexContent&gt;
      &lt;xs:restriction base=&quot;ProductType&quot;&gt;
        &lt;xs:openContent&gt;
          &lt;xs:any namespace=&quot;##other&quot;/&gt;
        &lt;/xs:openContent&gt;
        &lt;xs:sequence/&gt;
      &lt;/xs:restriction&gt;
    &lt;/xs:complexContent&gt;
  &lt;/xs:complexType&gt;

The discrepancy between the syntax display and the schema for schema documents, on the other hand, needs to be resolved to make them consistent.  I&apos;m not sure which to change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66899</commentid>
    <comment_count>2</comment_count>
    <who name="David Ezell">David_E3</who>
    <bug_when>2012-04-20 16:46:41 +0000</bug_when>
    <thetext>WG decided that the group following openContent should be optional.

Gives a work-around and a fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66900</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2012-04-20 16:49:15 +0000</bug_when>
    <thetext>(Note Saxon 9.4 accepts this example, but its parsing in this area uses a state machine that was originally constructed automatically from the S4S. Need to investigate how this happened).

The example in the bug has been added to the test suite as saxonData/Complex/complex017.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66908</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2012-04-20 20:30:39 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; (Note Saxon 9.4 accepts this example, but its parsing in this area uses a state
&gt; machine that was originally constructed automatically from the S4S. Need to
&gt; investigate how this happened).
&gt; 

I don&apos;t know whether the archaeology is useful, but I have a copy of a compiled version of the S4S created on 2007-03-05 in which it is clear that the typeDefParticle in the content model at that time had a minOccurs of zero. I don&apos;t have the corresponding source, but another compiled version from 2007-08-30 appears to make typeDefParticle mandatory. The current Saxon source appears to be built from the earlier version: it is characterized by the fact that the transition corresponding to openContent is to a state labelled as a final state. I&apos;ve used the same code to regenerate the FSM from the current S4S, and as one would expect, it requires content after the openContent element.

So I would suggest that we made a change to the S4S at some time during mid 2007 which introduced a bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66926</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2012-04-21 22:41:24 +0000</bug_when>
    <thetext>
&gt; So I would suggest that we made a change to the S4S at some time during mid
&gt; 2007 which introduced a bug.

I should perhaps have added:

* the working draft of 2007-08-30 is essentially the same as the final version

* the previous published working draft of 2006-08-31 did not include openContent

* therefore it would appear that the version I used to generate my grammar was an unpublished draft; I&apos;ve done some searching through the mail archives but haven&apos;t been able to locate such a draft.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76819</commentid>
    <comment_count>6</comment_count>
    <who name="C. M. Sperberg-McQueen">cmsmcq</who>
    <bug_when>2012-10-20 20:58:51 +0000</bug_when>
    <thetext>A diffed version of the spec showing a draft erratum for this issue is now on the server at

  https://www.w3.org/XML/Group/2004/06/xmlschema-1/structures.errata-2012.html
  (member-accessible link)

The WG did not want to review this text, so I&apos;m marking this bug as &apos;needs publication&apos;.

[Note:  I have not invested any time in figuring out what went wrong here.  So if this error is the tip of an iceberg, we have avoided taking this opportunity to discover the fact.]

Priscilla, if you could, please review the resolution of the issue and let us know whether you have any objections to it.  If we don&apos;t hear from you in the next two weeks or so, we&apos;ll assume you are happy with the changes.  (If you don&apos;t currently have member access, let us know so I can send you a copy of the diffed spec.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76840</commentid>
    <comment_count>7</comment_count>
    <who name="Priscilla Walmsley">pwalmsley</who>
    <bug_when>2012-10-21 14:52:08 +0000</bug_when>
    <thetext>Looks good to me.  Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78716</commentid>
    <comment_count>8</comment_count>
    <who name="C. M. Sperberg-McQueen">cmsmcq</who>
    <bug_when>2012-11-23 17:24:48 +0000</bug_when>
    <thetext>Since PW has already reviewed and agreed with the change, I&apos;m closing this issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>120456</commentid>
    <comment_count>9</comment_count>
    <who name="Priscilla Walmsley">pwalmsley</who>
    <bug_when>2015-05-23 18:59:56 +0000</bug_when>
    <thetext>Changing status from CLOSED back to RESOLVED because otherwise this bug does not appear in the search linked to from the Errata page at http://www.w3.org/XML/XMLSchema/v1.1/1e/errata.html</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>