Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: Restricting child elements in a schema

From: "Michael Kay" <mike@--------.--->
To: "'Dilpa Mehta'" <dilpamehta@-------.--->, <xmlschema-dev@--.--->
Date: 12/1/2004 9:39:00 PM
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:choice>
  <xs:attribute name="Type" type="xs:string"/>
  <xs:attribute name="Method" type="xs:string"/>
 </xs:complexType>
 
 <xs:complexType name="IndivNameVariationType" mixed="true">
     <xs:complexContent>
        <xs:restriction base="IndivNameType">
          <xs:choice minOccurs="0" maxOccurs="unbounded">
           <xs:element name="NamePart" type="xs:string"/>
          </xs:choice>
      </xs:restriction>
  </xs:complexContent>        
 </xs:complexType>
 
Where exactly are you having problems?
 
You can't restrict and extend at the same time: you have to do this in two
steps.
 
Michael Kay


  _____  

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


Hi,

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?

Thanks




 

  _____  

The all-new MSN Search. Get fast and precise results. Try it now!
<http://g.msn.com/8HMAENIN/2746??PS=47575>  



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent