W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2002

RE: Question about complexContent restriction

From: Dare Obasanjo <dareo@microsoft.com>
Date: Sat, 20 Jul 2002 20:13:51 -0700
Message-ID: <8BD7226E07DDFF49AF5EF4030ACE0B7E06621E0A@red-msg-06.redmond.corp.microsoft.com>
To: "Brenda Bell" <bbell@juicesoftware.com>, <xmlschema-dev@w3.org>

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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:57 UTC