pervasiveness of a redefine

How pervasive should a redefine be?  For example:

 
File A defines Employee type
File B includes File A and defines Department type
File C includes File B, redefines Employee from File A and defines
Company type

 

I think this is a common use case for redefine in which a type defined
in a nested include
needs to be redefined.  Are the schemas I've included below the correct
way of expressing this?  XSV handles this case in the way I'd expect,
redefining the Employee type in all occurrences.
 
Also, what is the "scope" of a redefine and how should conflicts be
resolved?  For example, are there cases in which the original Employee
type would be used?  And what about redefining a type in
multiple/different ways?  For example, if there was a File D that
redefined the Employee type from File A in a different way to create a
new derived type.  Could File D be included and the new derived type
used in File C?  
 
Thanks,

 

            James

 

 
Employee.xsd:
<xs:schema targetNamespace="http://namespaces.nextance.com/test"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:test="http://namespaces.nextance.com/test"
elementFormDefault="qualified" attributeFormDefault="qualified">
  <xs:complexType name="Employee">
    <xs:sequence>
      <xs:element name="name" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:schema>
 
Department.xsd:
<xs:schema targetNamespace="http://namespaces.nextance.com/test"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:test="http://namespaces.nextance.com/test"
elementFormDefault="qualified" attributeFormDefault="qualified">
  <xs:include schemaLocation="Employee.xsd"/>
  <xs:complexType name="Department">
    <xs:sequence>
      <xs:element name="employee" type="test:Employee"
maxOccurs="unbounded"/>
      <xs:element name="manager" type="test:Employee"/>
    </xs:sequence>
  </xs:complexType>
</xs:schema>
 
Company.xsd:

<xs:schema targetNamespace="http://namespaces.nextance.com/test"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:test="http://namespaces.nextance.com/test"
elementFormDefault="qualified" attributeFormDefault="qualified">

  <xs:include schemaLocation="Department.xsd"/>

  <xs:redefine schemaLocation="Employee.xsd">

    <xs:complexType name="Employee">

      <xs:complexContent>

        <xs:extension base="test:Employee">

          <xs:sequence>

            <xs:element name="ranking" type="xs:int"/>

          </xs:sequence>

        </xs:extension>

      </xs:complexContent>

    </xs:complexType>

  </xs:redefine>

  <xs:complexType name="Company">

    <xs:sequence>

      <xs:element name="department" type="test:Department"
maxOccurs="unbounded"/>

      <xs:element name="president" type="test:Employee"/>

    </xs:sequence>

  </xs:complexType>

  <xs:element name="fortune500" type="test:Company"/>

</xs:schema>

Received on Friday, 26 March 2004 16:39:54 UTC