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

Re: element name/ref uniqueness

From: Eddie Robertsson <eddie@allette.com.au>
Date: Wed, 16 May 2001 10:12:46 +1000
Message-ID: <3B01C5FD.4F8FC421@allette.com.au>
To: Michael Shapiro <michael@creativescience.com>
CC: xmlschema-dev@w3.org
> 2.3 For each element information item in the sequence one of the following
> must be true:
> 2.3.1 The element declaration is local ...
> 2.3.2 The element declaration is top-level ...
>
> Does it mean that the following schema is invalid?
>
> <schema>
>     <element name="inner"/>
>     <element name="outer">
>         <complexType>
>             <sequence>
>                 <element ref="inner"/>
>                 <element name="inner"/>
>             </sequence>
>         </complexType>
>     </element>
> </schema>

No, I believe this is valid since you are allowed to have to elements with the
same name in the same content model if the type is the same (in this case the
anyType) according to [1]:

"When two or more particles contained directly or indirectly in the {particles}
of a model group have identically named element declarations as their {term},
the type definitions of those declarations must be the same. By 'indirectly' is
meant particles within the {particles} of a group which is itself the {term} of
a directly contained particle, and so on recursively."

<schema>
    <element name="inner"/> <!-- Top-level declaration -->
    <element name="outer"> <!-- Top-level declaration -->
        <complexType>
            <sequence>
                <element ref="inner"/> <!-- Reference to Top-level declaration
-->
                <element name="inner"/> <!-- Local declaration -->
            </sequence>
        </complexType>
    </element>
</schema>


> Is the following schema valid?
>
> <schema>
>     <element name="outer">
>         <complexType>
>             <sequence>
>                 <element name="inner"/>
>                 <element name="inner"/>
>             </sequence>
>         </complexType>
>     </element>
> </schema>

Yes, it's valid (see above)

> Where in the "A Schema for Schemas (normative)" such constraints are
> specified (uniqueness?, key/keyref pair?)?
> Or this is described only in nn 3.4.9 ?

I found this in [1] but maybe it's explained somewhere else as well.

Cheers,
/Eddie

[1] http://www.w3.org/TR/xmlschema-1/#Model_Group_details
Received on Tuesday, 15 May 2001 20:14:54 GMT

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