<?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>3996</bug_id>
          
          <creation_ts>2006-11-22 04:22:41 +0000</creation_ts>
          <short_desc>R-230: Question on maxOccurs=0, particles and restriction</short_desc>
          <delta_ts>2012-12-04 00:50:51 +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.0 only</version>
          <rep_platform>All</rep_platform>
          <op_sys>Windows 3.1</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></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="Sandy Gao">sandygao</reporter>
          <assigned_to name="David Ezell">David_E3</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>12986</commentid>
    <comment_count>0</comment_count>
    <who name="Sandy Gao">sandygao</who>
    <bug_when>2006-11-22 04:22:41 +0000</bug_when>
    <thetext>Please clarify an issue regarding the use of maxOccurs=&quot;0&quot;, particularly within 
a type derived by &lt;restriction&gt; 

From various places in the Structures recommendation I have gathered the 
following information: 

1. Where minOccurs=maxOccurs=0, the item &quot;corresponds to no component at all.&quot; 
[repeated] 

2. The Particle Schema Component: {max occurs} - &quot;Either a non-negative integer 
or unbounded.&quot; http://www.w3.org/TR/xmlschema-1/#p-max_occurs 

3. Particle Correct: for all particles &quot;{max occurs} must be greater than or 
equal to 1.&quot; http://www.w3.org/TR/xmlschema-1/#p-props-correct 

Also, from the Primer: 

4. An element with minOccurs=&quot;0&quot; and maxOccurs=&quot;0&quot; means the element &quot;must not 
appear.&quot; http://www.w3.org/TR/xmlschema-0/#cardinalityTable 

5. In restriction, minOccurs=&quot;0&quot; and maxOcurs=&quot;0&quot; means &quot;exclusion of an 
optional component.&quot; http://www.w3.org/TR/xmlschema-0/#restrictsTable 

It seems to me that (2) and (3) conflict. (2) effectively says that a particle 
may have maxOccurs=&quot;0&quot; while (3) says this would not be a correct particle. Is 
an incorrect particle still a particle?? I&apos;m not sure that (1) excuses this 
conflict. Looking at the Errata I cannot see any substantive changes to these 
definitions. 

The problem I have specifically relates to restriction of a complexType 
containing a sequence. As I understand it, the derived restricted sequence can 
either simply not mention the element I wish to &apos;prohibit&apos; or can explicitly 
prohibit it by specifying maxOccurs=&quot;0&quot; and this should mean the same thing. 
However, (3) implies that the latter would not validate. 

E.g.

   &lt;complexType name=&quot;base&quot;&gt;
     &lt;sequence&gt;
       &lt;element name=&quot;a&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
       &lt;element name=&quot;b&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
       &lt;element name=&quot;c&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
     &lt;/sequence&gt;
   &lt;/complexType&gt;

   &lt;complexType name=&quot;deriveByOmission&quot;&gt;
     &lt;complexContent&gt;
       &lt;restriction base=&quot;base&quot;&gt;
         &lt;sequence&gt;
           &lt;element name=&quot;a&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
           &lt; prohibit element &quot;b&quot; by omission --&gt;
           &lt;element name=&quot;c&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
         &lt;/sequence&gt;
       &lt;/restriction&gt;
     &lt;/complexContent&gt;
   &lt;/complexType&gt;

   &lt;complexType name=&quot;deriveByZeroOccurrence&quot;&gt;
     &lt;complexContent&gt;
       &lt;restriction base=&quot;base&quot;&gt;
         &lt;sequence&gt;
           &lt;element name=&quot;a&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
           &lt;element name=&quot;b&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;0&quot;/&gt; &lt;!-- prohibit
element &quot;b&quot; --&gt;
           &lt;element name=&quot;c&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
         &lt;/sequence&gt;
       &lt;/restriction&gt;
     &lt;/complexContent&gt;
   &lt;/complexType&gt;

(Helpfully, of the seven schema tools I&apos;ve tried, 5 accept both derivations 
(but given other experiences are maybe just too lax) and 2 refuse both...) 

Which of these 2 derivations are correct?

See:
http://lists.w3.org/Archives/Public/www-xml-schema-comments/2003JulSep/0042.html</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>