Re: [Moderator Action] Question related to XML Schema

"Rishi Chandra" <rishi_chandra@intersolutions.stpn.soft.net> writes:

> I wanted to know whether in XML-Schema there is any way in which a member
> (an element defined in a complexType) can be extended/restricted (basically
> sub-typed)? I wanted to define few types (which will have elements of some
> other types) and then keep on evolving sub-types by extension and
> restriction.

Sorry for slow reply, I've been on the road (at XML Schema meetings :-).

If I've understood correctly, the answer is yes.

For example, given 

 <xs:complexType name='big'>
  <xs:sequence>
   <xs:element name='sub1' type='sub1Type'/>
   . . .
  </xs:sequence>
 </xs:complexType>

 <xs:complexType name='sub1Type'>
  <xs:choice>
   <xs:element ref='part1'/>
   <xs:element ref='part2'/>
   <xs:element ref='part3'/>
  </xs:choice>
 </xs:complexType>

then the following is cool

 <xs:complexType name='little'>
  <xs:complexContent>
   <xs:restriction base='big'>
    <xs:sequence>
     <xs:element name='sub1' type='sub1TypeTwo'/>
     . . .
    </xs:sequence>
   </xs:restriction>
  </xs:complexContent>
 </xs:complexType>

 <xs:complexType name='sub1TypeTwo'>
  <xs:complexContent>
   <xs:restriction base='sub1Type'>
    <xs:choice>
     <xs:element ref='part1'/>
     <xs:element ref='part2'/>
    </xs:choice>
   </xs:restriction>
  </xs:complexContent>
 </xs:complexType>

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/

Received on Thursday, 30 November 2000 04:57:50 UTC