Re: element name/ref uniqueness

> 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 UTC