[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:23:52 UTC