RE: Question about complexContent restriction

This topic was just discussed a few weeks ago. Please read the archived thread at 
 
    http://lists.w3.org/Archives/Public/xmlschema-dev/2002Jul/0040.html <http://lists.w3.org/Archives/Public/xmlschema-dev/2002Jul/0040.html>  

 -----Original Message----- 
 From: Brenda Bell [mailto:bbell@juicesoftware.com] 
 Sent: Sat 7/20/2002 5:54 PM 
 To: 'xmlschema-dev@w3.org' 
 Cc: 
 Subject: Question about complexContent restriction
 
 

 I'm trying really hard to understand this schema stuff, but the examples I'm finding are making it difficult :) 

 I found the following example: 

 <xs:complexType name="address"> 
   <xs:sequence> 
     <xs:element name="street" type="xs:string" /> 
     <xs:element name="city" type="xs:string" /> 
     <xs:element name="zipcode" type="xs:integer" /> 
     <xs:element name="country" type="xs:string" /> 
   </xs:sequence> 
 </xs:complexType> 

 <xs:complexType name="USAddress"> 
   <xs:complexContent> 
     <xs:restriction base="address"> 
       <xs:sequence> 
         <xs:element name="street" type="xs:string" /> 
         <xs:element name="city" type="xs:string" /> 
         <xs:element name="zipcode" type="xs:integer" /> 
         <xs:element name="country" type="xs:string" fixed="US" /> 
       </xs:sequence> 
     </xs:restriction> 
   </xs:complexContent> 
 </xs:complexType> 

 It appears that USAddress does nothing more than redefine address with the additional restriction that country's value be fixed to "US".  Seems I could have gotten the same results by defining complexContent without the restriction so I'm thinking there must be more to a restriction that what this example shows.

 What am I missing?  Better yet, I'd love to see other examples of where you would actually use a restriction to see if I can figure it out for myself.

 Brenda Bell 
 Sr. Software Architect 
 Juice Software, Inc. 
 Phone: 603.428.3994 
 Cell:  603.494.8206 
 Fax:   603.428.8713 
 Email: bbell@juicesoftware.com 
 MSN:   bbell@theotherbell.com 

Received on Saturday, 20 July 2002 23:14:25 UTC