W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2002

Correction: Restricting an anyType?

From: <Simon.Cox@csiro.au>
Date: Thu, 21 Feb 2002 15:03:22 +0800
Message-ID: <116D27C8E12BD411B3AB00B0D022B0B8AF0A1A@yate.wa.csiro.au>
To: xmlschema-dev@w3.org
Sorry - in my haste to get the question out 
via a trimmed down schema I cocked it up.  

Here is the question again:

In the following schema I use an anyType element 
to head a substitutionGroup.  
I use this in a content model for ValType, with 
unlimited cardinality.  

I define a complexType and two elements based on 
it in the substitutionGroup.  
Then I try to derive IdentifiersPropertyType 
containing these, by restriction from ValType.  

Spy says OK, but Xerces (via SQC) says this is illegal.  

Who's correct?

Here is the real problem schema:

==============
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://www.opengis.net/gml"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified">
  <!-- =========================================================== -->
  <element name="_Object" type="anyType" abstract="true"/>
  <element name="_property" type="anyType" abstract="true"/>
  <!-- =========================================================== -->
  <complexType name="ValType">
    <sequence>
      <element ref="gml:_Object" maxOccurs="unbounded"/>
    </sequence>
  </complexType>
  <element name="_val" type="gml:ValType" abstract="true"
substitutionGroup="gml:_property"/>
  <!-- =========================================================== -->
  <complexType name="IdentifiersPropertyType">
    <complexContent>
      <restriction base="gml:ValType">
        <sequence>
          <element ref="gml:Identifier"/>
          <element ref="gml:Alias" minOccurs="0" maxOccurs="unbounded"/>
        </sequence>
      </restriction>
    </complexContent>
  </complexType>
  <element name="identifiers" type="gml:IdentifiersPropertyType"
substitutionGroup="gml:_property"/>
  <!-- =========================================================== -->
  <element name="name" type="string" substitutionGroup="gml:_property"/>
  <element name="namespace" type="string"/>
  <element name="version" type="string"/>
  <complexType name="IdentifierType">
    <sequence>
      <element ref="gml:name"/>
      <element ref="gml:namespace"/>
      <element ref="gml:version" minOccurs="0"/>
    </sequence>
  </complexType>
  <element name="Identifier" type="gml:IdentifierType"
substitutionGroup="gml:_Object"/>
  <element name="Alias" type="gml:IdentifierType"
substitutionGroup="gml:_Object"/>
  <!-- =========================================================== -->
</schema>

_____
Simon.Cox@csiro.au  CSIRO Exploration & Mining
26 Dick Perry Avenue, Kensington WA 6151
PO Box 1130, Bentley WA 6102  AUSTRALIA
T: +61 (8) 6436 8639  F: +61 (8) 6436 8555  C: +61 (4) 0330 2672
http://www.csiro.au/page.asp?type=resume&id=CoxSimon
Received on Thursday, 21 February 2002 02:11:48 GMT

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