W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2001

[xmlschema-dev] <none>

From: Stephen Bailey <usabailey@hotmail.com>
Date: Wed, 22 Aug 2001 12:01:01 -0400 (EDT)
To: davec@progress.com, bigangellover@yahoo.com, xmlschema-dev@w3.org
Message-ID: <F225mbfJ8VrRQvXlaoY000052a8@hotmail.com>
This is an example I knocked up after reading David's posting so you can see 
what he is getting at (Uses UK and US address formats):

Schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified">

	<xs:complexType name="address" abstract="true">
		<xs:sequence>
			<xs:element name="street" type="xs:string" maxOccurs="2"/>
		</xs:sequence>
	</xs:complexType>

	<xs:complexType name="ukAddress">
		<xs:complexContent>
			<xs:extension base="address">
				<xs:sequence>
					<xs:element name="town" type="xs:string"/>
					<xs:element name="county" type="xs:string"/>
					<xs:element name="postcode" type="xs:string"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>

	<xs:complexType name="usAddress">
		<xs:complexContent>
			<xs:extension base="address">
				<xs:sequence>
					<xs:element name="city" type="xs:string"/>
					<xs:element name="state" type="xs:string"/>
					<xs:element name="zip" type="xs:string"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>

	<xs:complexType name="test">
		<xs:sequence>
			<xs:element name="address" type="address"/>
		</xs:sequence>
	</xs:complexType>

	<xs:element name="test" type="test"/>
</xs:schema>


Instance:

<?xml version="1.0" encoding="UTF-8"?>
<test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="address.xsd">
	<address xsi:type="ukAddress">
		<street/>
		<town/>
		<county/>
		<postcode/>
	</address>
</test>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
Received on Friday, 24 August 2001 05:28:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:23 GMT