Questions about local refs

Question 1:  are 'local' refs allowed or not?:

<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
  <xsd:complexType name="ChoiceOfSameNames">
    <xsd:choice>
      <xsd:element name="Element01" type="xsd:string"/>
      <xsd:element ref="Element01"/>
    </xsd:choice>
  </xsd:complexType>
</xsd:schema>

Question 2:  If the previous schema is valid, what would happen if the
schema contains different global and local declarations of 'Element01'?
(see schema below)

What is the <xsd:element ref="Element01"/> refering to, the global <
xsd:element name="Element01" type="xsd:boolean"/>, or the local   <
xsd:element name="Element01" type="xsd:string"/> ?

<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
  <xsd:element name="Element01" type="xsd:boolean"/>
  <xsd:complexType name="ChoiceOfSameNames">
    <xsd:choice>
      <xsd:element name="Element01" type="xsd:string"/>
      <xsd:element ref="Element01"/>
    </xsd:choice>
  </xsd:complexType>
</xsd:schema>

If the 'ref' scope is global, the schema would be invalid. If the 'ref'
scope is local, the schema is valid.

+ If the global and local declarations of 'Element01' are the same. It does
not matter if the 'ref' is local or global:

<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
  <xsd:element name="Element01" type="xsd:string"/>
  <xsd:complexType name="ChoiceOfSameNames">
    <xsd:choice>
      <xsd:element name="Element01" type="xsd:string"/>
      <xsd:element ref="Element01"/>
    </xsd:choice>
  </xsd:complexType>
</xsd:schema>

Thank you,
Bob Schloss and Roberto Galnares

(IBM Thomas J. Waston Research Center)

Received on Tuesday, 28 November 2000 14:55:41 UTC