W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2009

RE: [XML Schema 1.1] Many questions about openContent

From: Costello, Roger L. <costello@mitre.org>
Date: Fri, 29 May 2009 11:50:13 -0400
To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Message-ID: <9E51F88D5247B648908850C35A3BBB5003FD40C13B@IMCMBX3.MITRE.ORG>
 
Thanks Michael.

So the <any> element within an <openContent> is always (effectively) minOccurs="1" and maxOccurs="1". Correct?

That is, it is effectively this:

<element name="Book">
    <complexType>
        <openContent mode="interleaved">
            <any minOccurs="1" maxOccurs="1" />
        </openContent>
        <sequence>
            <element name="Title" type="string"/>
            <element name="Author" type="string" />
            <element name="Date" type="string"/>
            <element name="ISBN" type="string"/>
            <element name="Publisher" type="string"/>
        </sequence>
    </complexType>
</element>

Correct?

Now, what does that mean?

Does it mean that 1 new element *must* be inserted into the <sequence> content model? Or, does it mean that:

   Before the <Title> element there *must* be 1 new element, and
   Before the <Author element there *must* be 1 new element, and
   Before the <Date> element there *must* be 1 new element, and
   Before the <ISBN> element there *must* be 1 new element, and
   Before the <Publisher> element there *must* be 1 new element, and
   After the <Publisher> element there *must* be 1 new element.


And what about mode="suffix":

<element name="Book">
    <complexType>
        <openContent mode="suffix">
            <any />
        </openContent>
        <sequence>
            <element name="Title" type="string"/>
            <element name="Author" type="string" />
            <element name="Date" type="string"/>
            <element name="ISBN" type="string"/>
            <element name="Publisher" type="string"/>
        </sequence>
    </complexType>
</element>

Does this mean that 1 new element must always be placed at the bottom of the <sequence> content model (after the <Publisher> element)?

/Roger



> -----Original Message-----
> From: Michael Kay [mailto:mike@saxonica.com] 
> Sent: Friday, May 29, 2009 11:39 AM
> To: Costello, Roger L.; xmlschema-dev@w3.org
> Subject: RE: [XML Schema 1.1] Many questions about openContent
> 
> 
> On the first question, the schema component model for open 
> content does not
> include a minOccurs and maxOccurs value (the {open content} 
> property is a
> wildcard, not a wildcard particle). As far as I can see, it 
> is permitted to
> specify these values in the XML representation, but they are ignored.
> Perhaps they should not be allowed: I'll raise a bug to propose this.
> 
> On the second question, mode="none" is used in the same way as
> use="prohibited" on attributes, to suppress inheritance of 
> openContent in a
> type that would otherwise acquire it automatically.
> 
> Regards,
> 
> Michael Kay
> http://www.saxonica.com/
> http://twitter.com/michaelhkay 
> 
>  
> 
> > -----Original Message-----
> > From: xmlschema-dev-request@w3.org 
> > [mailto:xmlschema-dev-request@w3.org] On Behalf Of 
> Costello, Roger L.
> > Sent: 29 May 2009 16:23
> > To: 'xmlschema-dev@w3.org'
> > Subject: [XML Schema 1.1] Many questions about openContent
> > 
> > 
> > Hi Folks,
> > 
> > Here is an example of declaring a <Book> element with open content:
> > 
> > <element name="Book">
> >     <complexType>
> >         <openContent mode="interleaved">
> >             <any minOccurs="..." maxOccurs="..." />
> >         </openContent>
> >         <sequence>
> >             <element name="Title" type="string"/>
> >             <element name="Author" type="string" />
> >             <element name="Date" type="string"/>
> >             <element name="ISBN" type="string"/>
> >             <element name="Publisher" type="string"/>
> >         </sequence>
> >     </complexType>
> > </element>
> > 
> > Notice that I left unspecified the value of minOccurs and 
> > maxOccurs on the <any> element.
> > 
> > If I specify minOccurs="0" and maxOccurs="1" does it mean 
> > that 0-1 new elements can be inserted into the <sequence> 
> > content model? Or, does it mean that:
> > 
> >    Before the <Title> element there can be 0-1 new elements, and
> >    Before the <Author element there can be 0-1 new elements, and
> >    Before the <Date> element there can be 0-1 new elements, and
> >    Before the <ISBN> element there can be 0-1 new elements, and
> >    Before the <Publisher> element there can be 0-1 new elements, and
> >    After the <Publisher> element there can be 0-1 new elements.
> > 
> > If I specify minOccurs="1" and maxOccurs="1" does it mean 
> > that 1 new element must be inserted into the <sequence> 
> > content model? Or, does it mean that:
> > 
> >    Before the <Title> element there must be 1 new element, and
> >    Before the <Author element there must be 1 new element, and
> >    Before the <Date> element there must be 1 new element, and
> >    Before the <ISBN> element there must be 1 new element, and
> >    Before the <Publisher> element there must be 1 new element, and
> >    After the <Publisher> element there must be 1 new element.
> > 
> > If I specify minOccurs="0" and maxOccurs="unbounded" does it 
> > mean that 0-unbounded new elements can be inserted into the 
> > <sequence> content model? Or, does it mean that:
> > 
> >    Before the <Title> element there can be 0-unbounded new 
> > elements, and
> >    Before the <Author element there can be 0-unbounded new 
> > elements, and
> >    Before the <Date> element there can be 0-unbounded new 
> > elements, and
> >    Before the <ISBN> element there can be 0-unbounded new 
> > elements, and
> >    Before the <Publisher> element there can be 0-unbounded 
> > new elements, and
> >    After the <Publisher> element there can be 0-unbounded new 
> > elements.
> > 
> > 
> > Next, suppose I change the mode to 'suffix':
> > 
> > <element name="Book">
> >     <complexType>
> >         <openContent mode="suffix">
> >             <any minOccurs="..." maxOccurs="..." />
> >         </openContent>
> >         <sequence>
> >             <element name="Title" type="string"/>
> >             <element name="Author" type="string" />
> >             <element name="Date" type="string"/>
> >             <element name="ISBN" type="string"/>
> >             <element name="Publisher" type="string"/>
> >         </sequence>
> >     </complexType>
> > </element>
> > 
> > I believe mode="suffix" means that new elements must always 
> > be placed at the bottom of the <sequence> content model 
> > (after the <Publisher> element). Correct?
> > 
> > If I specify minOccurs="0" and maxOccurs="1" does it mean 
> > that 0-1 new elements can be inserted at the bottom of the 
> > <sequence> content model? 
> > 
> > If I specify minOccurs="1" and maxOccurs="1" does it mean 
> > that 1 new element must be inserted at the bottom of the 
> > <sequence> content model? 
> > 
> > If I specify minOccurs="0" and maxOccurs="unbounded" does it 
> > mean that 0-unbounded new elements can be inserted at the 
> > bottom of the <sequence> content model? 
> > 
> > 
> > Lastly, suppose I change the mode to 'none':
> > 
> > <element name="Book">
> >     <complexType>
> >         <openContent mode="none">
> >             <any minOccurs="..." maxOccurs="..." />
> >         </openContent>
> >         <sequence>
> >             <element name="Title" type="string"/>
> >             <element name="Author" type="string" />
> >             <element name="Date" type="string"/>
> >             <element name="ISBN" type="string"/>
> >             <element name="Publisher" type="string"/>
> >         </sequence>
> >     </complexType>
> > </element>
> > 
> > What does mode="none" mean? Does it mean:
> > 
> >     You cannot insert new elements into the <sequence> 
> content model.
> > 
> > How is it different from this (no openContent specified):
> > 
> > <element name="Book">
> >     <complexType>
> >         <sequence>
> >             <element name="Title" type="string"/>
> >             <element name="Author" type="string" />
> >             <element name="Date" type="string"/>
> >             <element name="ISBN" type="string"/>
> >             <element name="Publisher" type="string"/>
> >         </sequence>
> >     </complexType>
> > </element>
> > 
> > Are they the same? If they are, why have mode="none"? What's 
> > its value?
> > 
> > /Roger
> 
> 
Received on Friday, 29 May 2009 15:50:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:15:12 GMT