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

Please help: Constraints on Particle Schema Components

From: Michael Shapiro <michael@creativescience.com>
Date: Sun, 20 May 2001 16:45:39 -0700
Message-ID: <00ce01c0e186$fa171d60$110a0a0a@voquetter>
To: <xmlschema-dev@w3.org>
In http://www.w3.org/TR/xmlschema-1/#cos-particle-restrict (3.9.6...
Particle Valid (Restriction).) there is a definition of pointlessness:

2.2 Any pointless occurrences of <sequence>, <choice> or <all> are ignored,
where pointlessness is understood as follows:
<sequence>
    One of the following must be true:
    2.2.1 {particles} is empty.
    2.2.2 All of the following must be true:
    2.2.2.1 The particle within which this <sequence> appears has {max
occurs} and {min occurs} of 1.
    2.2.2.2 One of the following must be true:
    2.2.2.2.1 The <sequence>'s {particles} has only one member.
    2.2.2.2.2 The particle within which this <sequence> appears is itself
among the {particles} of a <sequence>.

Now, let's say I have the schema with the sequence of element and a choice
particle, where the choice particle consists of two sequences with two
elements in each:

<schema>
    <element name="root">
        <complexType>
            <sequence>
                <element name="a"/>

                <!-- this particle has min and max occurs of 1(nn 2.2.2.1 is
true) -->
                <!-- this particle is also among the {particles} of a
sequence -->
                <choice>

                    <!--
                        this sequence's parent particle is
                        itself among the {particles} of a sequence
                        (2.2.2.2.2 is true).
                        AND
                        The particle within which this <sequence>
                        appears has {max occurs} and {min occurs} of 1
                        (2.2.2.1 is true)

Question: is this sequence "pointless"? why?

                    -->
                    <sequence minOccurs="0">
                        <element name="b"/>
                        <element name="c"/>
                    </sequence>

                    <!--
                        this sequence's parent particle is
                        also among the {particles} of a sequence
                        (2.2.2.2.2 is true).
                        (2.2.2.1 is true)

Question: is this sequence "pointless"? why?

                    -->
                    <sequence>
                        <element name="d"/>
                        <element name="e"/>
                    </sequence>
                </choice>
            </sequence>
        </complexType>
    </element>
</schema>

The schema should validate the following three XML documents:
<root><a/></root>
<root><a/><b/><c/></root>
<root><a/><d/><e/></root>

It should not validate the following xml:
<root><a/><b/><c/><d/><e/></root>

What am I missing here?

Thank for <xs:any/> help,
Michael
Received on Sunday, 20 May 2001 19:58:37 GMT

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