<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.homeconnections.gov.uk" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.homeconnections.gov.uk" elementFormDefault="qualified" attributeFormDefault="unqualified" version="0.1" id="CBLAddressStructure">
	<!-- We ought to optionally use the bs7666 here, but the govtalk site has no refererence to the schema definition -->
	<xsd:annotation>
		<xsd:appinfo>
			<xsd:KeyWords>choice based letting, CBL, property, rent, points, address, registered individual				</xsd:KeyWords>
		</xsd:appinfo>
	</xsd:annotation>
	<!--
CBL - Choice Based Letting Pilot called 'Home Connections' : One of several DTLR funded pilots to provide user choice in the social housing arena.
XML Architecture Schema for Properties
Purpose: This schema is used to supply the CBL property addressing structures to architecture and message
schemas used throughout the entire CBL schema structures.
Heritage: this and related schema are loosely based on the CECA XML Schema published on govtalk
Date: 02/01/2002
Version: 0.1
Editor: Graham Read, Anite.net, Home Connections development team
-->
	<xsd:simpleType name="AddressPostCodeAreaType">
		<xsd:restriction base="xsd:string">
			<xsd:pattern value="[A-Z]{1,2}[0-9R][0-9A-Z]"/>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:simpleType name="AddressPostCodeStreetType">
		<xsd:restriction base="xsd:string">
			<xsd:pattern value="[0-9][A-Z]{2}"/>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:simpleType name="CBLAddressStreetNumberType">
		<xsd:restriction base="xsd:string">
			<xsd:maxLength value="10"/>
			<xsd:minLength value="1"/>
			<xsd:whiteSpace value="preserve"/>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:simpleType name="CBLAddressRoadType">
		<xsd:restriction base="xsd:string">
			<xsd:maxLength value="100"/>
			<xsd:minLength value="1"/>
			<xsd:whiteSpace value="preserve"/>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:simpleType name="CBLAddressNeighbourhoodType">
		<xsd:restriction base="xsd:string">
			<xsd:maxLength value="40"/>
			<xsd:minLength value="1"/>
			<xsd:whiteSpace value="preserve"/>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:simpleType name="CBLAddressTownType">
		<xsd:restriction base="xsd:string">
			<xsd:maxLength value="40"/>
			<xsd:minLength value="1"/>
			<xsd:whiteSpace value="preserve"/>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:simpleType name="CBLAddressCountyType">
		<xsd:restriction base="xsd:string">
			<xsd:maxLength value="30"/>
			<xsd:minLength value="1"/>
			<xsd:whiteSpace value="preserve"/>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:complexType name="CBLAddressStructure">
		<xsd:sequence>
			<xsd:element name="StreetNo" type="CBLAddressStreetNumberType" minOccurs="0"/>
			<xsd:element name="SubStreetNo" type="CBLAddressStreetNumberType" minOccurs="0"/>
			<xsd:element name="Road" type="CBLAddressRoadType" minOccurs="0"/>
			<xsd:element name="Neighbourhood" type="CBLAddressNeighbourhoodType" minOccurs="0"/>
			<xsd:element name="Town" type="CBLAddressTownType" minOccurs="0"/>
			<xsd:element name="County" type="CBLAddressCountyType" minOccurs="0"/>
			<xsd:element name="PostCodeArea" type="AddressPostCodeAreaType"/>
			<xsd:element name="PostCodeStreet" type="AddressPostCodeStreetType"/>
			<!--xsd:element name="UPRN" type="bs7666:UPRNtype" minOccurs="0"/-->
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="AddressStructure">
		<xsd:sequence>
			<xsd:choice>
				<xsd:element name="CBLAddress" type="CBLAddressStructure"/>
				<!--xsd:element name="BS7666Address" type="bs7666:BSaddressStructure"/-->
			</xsd:choice>
		</xsd:sequence>
	</xsd:complexType>
</xsd:schema>
