W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2004

RE: Restricting child elements in a schema

From: Michael Kay <mike@saxonica.com>
Date: Wed, 1 Dec 2004 21:39:02 -0000
To: "'Dilpa Mehta'" <dilpamehta@hotmail.com>, <xmlschema-dev@w3.org>
Message-Id: <E1CZcBn-0003KH-00@ukmail1.eechost.net>
You can define one complex type as a restriction of another, for example
 <xs:complexType name="IndivNameType" mixed="true">
  <xs:choice minOccurs="0" maxOccurs="unbounded">
   <xs:element name="NamePart" type="xs:string"/>
   <xs:element name="IndNameVariation" type="xs:string"/>
  <xs:attribute name="Type" type="xs:string"/>
  <xs:attribute name="Method" type="xs:string"/>
 <xs:complexType name="IndivNameVariationType" mixed="true">
        <xs:restriction base="IndivNameType">
          <xs:choice minOccurs="0" maxOccurs="unbounded">
           <xs:element name="NamePart" type="xs:string"/>
Where exactly are you having problems?
You can't restrict and extend at the same time: you have to do this in two
Michael Kay


From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] On
Behalf Of Dilpa Mehta
Sent: 01 December 2004 19:19
To: xmlschema-dev@w3.org
Subject: Restricting child elements in a schema


I have 2 schemas , schema A and schema B. I import schema A into schema B so
that i could reuse some complex types of schema A. I extend a that complex
type in schema B by using <<xs:extension base>. 

However, for few elements that i want to reuse, i also want to add
restriction like make them required as they are not required in the source
schema and i want this element to appear only once (the one i define in
schema B).

This is urgent , can someone help?




The all-new MSN Search. Get fast and precise results. Try it now!
Received on Wednesday, 1 December 2004 21:39:07 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:07 UTC