[xmlschema-dev] <none>

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 UTC