extending a content model

Hello,

We are having problems extending a content model. We have 2 different
schemas. In the first schema we define a content model. In the second schema
we want to re-use the model, but add an element to it at a certain location.
Example:

In first schema the model is: test (a | c).
In the second schema the model should become: test (a | b | c). It is
important that element names remain identical in both schemas.

How should we go about this?
Redefining a complex type by extension only seems to allow us appending
elements, but not inserting elements at specific locations.
Can we redefine a group to obtain this result?

Would the following be valid? In schema 1 define a group:
 <xs:group name="testGroup">
  <xs:choice>
   <xs:element ref="a"/>
   <xs:element ref="c"/>
  </xs:choice>
 </xs:group>

 <xs:element name="test">
    <xs:complexType">
       <xs:choice>
         <xs:group ref="testGroup"/>
       </xs:choice>
   </xs:complexType>
 </xs:element>

and in schema 2 redefine the group (and of course declare the new element)
 <xs:redefine schemaLocation="schema1.xsd">
  <xs:group name="testGroup">
   <xs:choice>
    <xs:element ref="a"/>
    <xs:element name="b"/>
    <xs:element ref="c"/>
   </xs:choice>
  </xs:group>
 </xs:redefine>

According to XML Spy and Turbo XML this would be valid; XSV reports errors:

<schemaDocAttempt URI='file:/D:/schema2.xsd' outcome='success'
source='redefine'/>
<bug>validator crash during command line:
Traceback (most recent call last):
  File "d:\work\XMLinter\fschema\XMLSchemaCore.py", line 468, in
checkinSchema
  File "d:\work\XMLinter\fschema\XMLSchemaCore.py", line 250, in fromFile
  File "d:\work\XMLinter\fschema\layer.py", line 275, in fromFile
  File "d:\work\XMLinter\fschema\layer.py", line 359, in processElement
  File "d:\work\XMLinter\fschema\layer.py", line 396, in processElement
  File "d:\work\XMLinter\fschema\XMLSchemaElt.py", line 712, in init
AttributeError: 'Choice' instance has no attribute 'redefine'
</bug>

Any pointers would be welcome.

Thanks.

Francis Brouns

Received on Tuesday, 29 October 2002 07:13:46 UTC