W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > October to December 2000

Questions about local refs

From: Bob Schloss <rschloss@us.ibm.com>
Date: Tue, 28 Nov 2000 14:57:48 -0500
To: www-xml-schema-comments@w3.org
Message-ID: <OF764F4F77.91607479-ON852569A5.006D460A@pok.ibm.com>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:49 GMT