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

[XML Schema 1.1] Many questions about openContent

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

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:23:52 GMT

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