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

how to redefine a content model

From: Francis Brouns <francis.brouns@ou.nl>
Date: Fri, 25 Oct 2002 09:25:40 +0200
Message-ID: <001701c27bf7$b9033950$91b01491@otecdev.pwo.ou.nl>
To: <xmlschema-dev@w3.org>


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.

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:element ref="a"/>
   <xs:element ref="c"/>

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

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

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

<schemaDocAttempt URI='file:/D:/schema2.xsd' outcome='success'
<bug>validator crash during command line:
Traceback (most recent call last):
  File "d:\work\XMLinter\fschema\XMLSchemaCore.py", line 468, in
  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'

Any pointers would be welcome.


Francis Brouns
Received on Friday, 25 October 2002 03:24:35 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:58 UTC