Re: Freely nested elements in Schema

Indeed this is what substitution groups are for:

<xs:complexType name="text" mixed="true">
  <xs:sequence minOccurs="0" maxOccurs="unbounded">
   <xs:element ref="span"/>
  </xs:sequence>
 </xs:complexType>
 
 <xs:element name="span" abstract="true" type="text"/>
 
 <xs:element name="emph" substitutionGroup="span"/>
 
 <xs:element name="font" substitutionGroup="span"/>
 
 <xs:element name="strong" substitutionGroup="span"/>
 
 <xs:element name="img" substitutionGroup="span">
  <xs:complexType>
   <xs:complexContent mixed="false">
    <xs:restriction base="text"/>
   </xs:complexContent>
  </xs:complexType>
 </xs:element>

Note that emph, font and strong will be of type 'text' by default.

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@inf.ed.ac.uk
                   URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]

Received on Thursday, 29 January 2004 04:44:55 UTC