Deriving type definition by restriction

Hi,

I'm trying to understand how tools can check if a complex type, derived
from another type  by restriction, is valid.
It seems to me that the latest spec is unclear on this issue.
In the section 3.6.2.Deriving type definitions by restriction, it is said :

"If the source definition has element-only or mixed content, restricting a
content model is also possible via the complexRestrictions option. In this
case  each particle within the restriction is matched one for one with the
corresponding particle in the source definition, and in each case a
restriction must be  effected, e.g. by narrowing the range of occurs, by
reducing the members of a disjunction or by replacing a wildcard with a
more explicit particle"

The problem is that in some cases there cannot be an  one to one
correspondence between the restricted particle and the one defined by the
source definition. This situation may occur in the following cases:


* Case 1: The source definition content model uses two or more ElementRef
with the same NCName and the same namespace:

Example:
     <schema targetNS="http//www.w3.org/XMLSchemaComments"
                        version="1.0"
                        xmlns="http://www.w3.org/1999/XMLSchema"  >

     <type name="typeA" content="elementOnly">
          <element ref="elementA" minOccurs="0" maxOccurs="3"/>
          <element ref="elementB" minOccurs="0" maxOccurs="1"/>
          <element ref="elementA" minOccurs= "0" maxOccurs="*"/>
     </type>

     <type name="typeB" source="typeA" derivedBy="restriction" >
          <restrictions>
               <element ref="elementA" minOccurs="1" maxOccurs="2"/>
          </restrictions>
     </type>
In this case, the restriction can apply to more  than one  particle in the
source definition.  The spec does not say how to resolve such ambiguous
case. Should we apply the restriction to the two particles <element
ref="elementA" > defined in the source definition? Or this situation should
be consider as  an error?

* Case2 : The source definition content model contains two or more
disjunctions (choice groups) which define  at least two identical
particles.
Example:
     <type name "typeA" content="elementOnly">
          <group order="choice"  >
               <element ref="elementA" />
               <element ref="elementB"/>
          </group>
          <element ref="elementC"/>
          <group order="choice"  >
               <element ref="elementA"/ >
               <element ref="elementB"/>
               <element ref="elementC"/>
               <element ref="elementD"/>
          </group>
     </type>

     <type name="typeB" source="typeA" derivedBy="restriction" >
          <restrictions>
               <group order="choice">
                    <element ref="elementA" />
               </group>
          </restrictions>
     </type>
We don't know to which particle in the source definition the restriction
should be applied.

Thanks,

Achille Fokoue.

Received on Wednesday, 16 February 2000 13:18:30 UTC