Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - Controlled Intermixing of Namespaced Element Types >Thread Next - Re: Controlled Intermixing of Namespaced Element Types Re: Controlled Intermixing of Namespaced Element TypesTo: Eliot Kimber <ekimber@---------------.---> Date: 3/23/2005 9:14:00 AM
Same answer as yesterday :-)
Substution groups were specifically designed to reconstruct the use of
parameter entities for content models as mechanisms for controlled
extension.
The requirement that the type of a substiution group member be derived
from the type of its head imposes the condition you require.
Again, as yesterday, if you want to require restriction, then use
"final='extension'" on the base type.
Quick sketch:
Table schema doc:
<xs:schema targetNamespace="http://www.example.org/table"
xmlns:tc="http://www.example.org/cell">
<xs:import namespace="http://www.example.org/cell"/>
. . .
<xs:element name="cell">
<xs:complexType>
<xs:sequence>
<xs:element ref="tc:content"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Table cell schema doc:
<xs:schema targetNamespace="http://www.example.org/cell"
xmlns="http://www.example.org/cell">
<xs:element name="content" abstract="true" type="contentType"/>
<xs:complexType name="contentType">
<xs:sequence>
...
</xs:sequence>
</xs:complexType>
</xs:schema>
User schema doc:
<xs:schema targetNamespace="http://www.example.org/user"
xmlns:tc="http://www.example.org/cell"
xmlns:tt="http://www.example.org/table"
xmlns="http://www.example.org/user">
<xs:import namespace="http://www.example.org/table"/>
<xs:import namespace="http://www.example.org/cell"/>
<xs:complexType name="myDisplay">
<xs:sequence>
...
<xs:element ref="tt:table"/>
...
</xs:sequence>
</xs:complexType>
<xs:element name="mdContent" type="mdContentType"
substitutionGroup="tc:content"/>
<xs:complexType name="mdContentType">
<xs:complexContent>
<xs:restriction base="tc:contentType">
...
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:schema>
Now an instance of the form
<tt:table>
. . .
<tt:cell>
<my:mdContent>
. . .
</my:mdContent>
</tt:cell>
. . .
</tt:table>
is schema-valid.
Hope this helps,
ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@i...
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
From easirois@r... Wed Mar 23 16:21:37 2005
Received: from bart.w3.org ([128.30.52.40])
by frink.w3.org with esmtp (Exim 4.44)
id | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
