- From: Ace <Ace@AceProgrammer.com>
- Date: Tue, 11 Apr 2000 16:42:00 -0700
- To: www-xml-schema-comments@w3.org
I noticed that in the examples that are in XML Schema Part 0: Primer, that the comment element is usually defined: <xsd:element ref="comment" minOccurs="0"/> The Primer explicitly says this means the element is optional. However, after looking at the spec and the explanation in the Primer, it seems to me that this actually makes the comment prohibited because it falls into the third case below. I hope I am mistaken. I'd rather the above syntax mean that the element is optional. Thanks, Nick K. Aghazarian === From section 4.3.2 of XML Schema Part 1: Structures: the element element information item has complexType or group as an ancestor and the ref [attribute] is present: Particle Schema Component Property Representation {min occurs} The lexical [value] of the minOccurs [attribute], if present, otherwise 1 {max occurs} 1. unbounded, if the maxOccurs [attribute] equals unbounded, 2. otherwise the numeric lexical [value] of the maxOccurs [attribute], if present, 3. otherwise the lexical [value] of the minOccurs [attribute], if present, 4. otherwise 1. === From section 2.2 of XML Schema Part 0: Primer: The comment element is optional within PurchaseOrderType because the value of the minOccurs attribute in its declaration is 0. An element is required to appear when the value of minOccurs is 1. The maximum number of times an element may appear is determined by the value of a maxOccurs attribute in its declaration. This may be a positive integer value such as 41, or the term unbounded to indicate there is no maximum number of occurrences. The default value for minOccurs is 1, but there is no default value for maxOccurs per se: When an element is declared without a maxOccurs attribute, the maximum number of the element's occurrences is equal to the value of the minOccurs attribute. If this value is also omitted, the element must appear exactly once. ===
Received on Tuesday, 11 April 2000 19:44:57 UTC