<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 rel. 3 U (http://www.xmlspy.com) by Paul Spencer (Boynings Consulting) -->
<!-- edited with XML Spy v4.2 U (http://www.xmlspy.com) by Paul Spencer (alphaXML Ltd.) -->
<!-- Schema for British Standard BS7666 address types -->
<!-- 
From: http://www.govtalk.gov.uk/documents/APD-v1-2.zip  2003-06-18
See:  http://xml.coverpages.org/namesAndAddresses.html#APD-v1-2

	Changes 1.1 to 1.2:
		PostCode pattern brought in line with Data standards catalogue
		Metadata brought up to latest version of standard
	Changes 1.0 to 1.1:
		Postcode element changed to PostCode
		PostcodeType and PosttownType changed to PostCodeType and PostTownType
		PostCodeType pattern changed to match GDSC. The pattern has been relaxed slightly to not exclude [CIKMOV] in one part since testing found postcode with these patterns. It is still to be determined whether these are valid postcodes.
		StreetDescriptiveIdentifierStructure has been made unambiguous (deterministic)
-->
<xsd:schema targetNamespace="http://www.govtalk.gov.uk/people/bs7666" xmlns="http://www.govtalk.gov.uk/people/bs7666" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.2" id="BS7666">
	<xsd:annotation>
		<xsd:appinfo xmlns:gms="http://www.govtalk.gov.uk/CM/gms">
			<Metadata xmlns="http://www.govtalk.gov.uk/CM/gms-xs">
				<Audience>e-service developers</Audience>
				<Contributor>Paul Spencer, Boynings Consulting  (mailto:paul.spencer@boynings.co.uk)</Contributor>
				<Contributor>e-champions,Government Schema Group, IDeA</Contributor>
				<Contributor>Adrian Kent, Office e-Envoy</Contributor>
				<Creator>Office of the e-Envoy (maito:govtalk@e-envoy.gsi.gov.uk </Creator>
				<Date>
					<Created>2003-02-11</Created>
				</Date>
				<Date>
					<Modified>2002-01-16</Modified>
				</Date>
				<Date>
					<Modified>2002-02-05</Modified>
				</Date>
				<Date>
					<Modified>2003-02-11</Modified>
				</Date>
				<Description>Schema for BS7666 definitions including addresses</Description>
				<Format>
					<MediaType>text/xml</MediaType>
					<Syntax>http://www.w3.org/2001/XMLSchema</Syntax>
					<Description>XML schema, W3C Recommendation 2001</Description>
				</Format>
				<Identifier>BS7666-v1-2</Identifier>
				<Language>[ISO 639-2/B] ENG</Language>
				<Publisher>Office of the e-Envoy, Stockley House,130 Wilton Road, London SW1V 1LQ</Publisher>
				<Rights>unclassified
					<Copyright>Crown copyright 2002, 2003</Copyright>
				</Rights>
				<Subject>
					<Category>People, communities and living</Category>
				</Subject>
				<Subject>
					<Project>UK GovTalk</Project>
				</Subject>
				<Title>BS7666 architectural schema</Title>
			</Metadata>
		</xsd:appinfo>
	</xsd:annotation>
	<!-- Basic BS7666 Compliant Address Element -->
	<xsd:complexType name="BSaddressStructure">
		<xsd:sequence>
			<xsd:element name="SAON" type="SAONtype" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>Secondary Addressable Object</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			<xsd:element name="PAON" type="PAONtype">
				<xsd:annotation>
					<xsd:documentation>Primary Addressable Object</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			<xsd:sequence>
				<xsd:element name="StreetDescription" type="StreetDescriptorType"/>
				<xsd:element name="UniqueStreetReferenceNumber" type="USRNtype" minOccurs="0"/>
			</xsd:sequence>
			<xsd:choice>
				<xsd:sequence>
					<xsd:element ref="Locality"/>
					<xsd:choice minOccurs="0">
						<xsd:sequence>
							<xsd:element ref="Town"/>
							<xsd:element ref="AdministrativeArea" minOccurs="0"/>
						</xsd:sequence>
						<xsd:element ref="AdministrativeArea"/>
					</xsd:choice>
				</xsd:sequence>
				<xsd:sequence>
					<xsd:element ref="Town"/>
					<xsd:element ref="AdministrativeArea" minOccurs="0"/>
				</xsd:sequence>
				<xsd:element ref="AdministrativeArea"/>
			</xsd:choice>
			<xsd:element name="PostTown" type="PostTownType" minOccurs="0"/>
			<xsd:element name="PostCode" type="PostCodeType" minOccurs="0"/>
			<xsd:element name="UniquePropertyReferenceNumber" type="UPRNtype" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>
	<!-- UPRN Definition as 2000-->
	<xsd:simpleType name="UPRNtype">
		<xsd:restriction base="xsd:integer">
			<xsd:minInclusive value="1"/>
			<xsd:maxInclusive value="999999999999"/>
		</xsd:restriction>
	</xsd:simpleType>
	<!-- USRN Definition as 2000-->
	<xsd:simpleType name="USRNtype">
		<xsd:restriction base="xsd:integer">
			<xsd:minInclusive value="1"/>
			<xsd:maxInclusive value="99999999"/>
		</xsd:restriction>
	</xsd:simpleType>
	<!-- PostCode Definition -->
	<xsd:simpleType name="PostCodeType">
		<xsd:restriction base="xsd:string">
			<xsd:pattern value="(GIR 0AA)|((([A-Z-[QVX]][0-9][0-9]?)|(([A-Z-[QVX]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVX]][0-9][A-HJKSTUW])|([A-Z-[QVX]][A-Z-[IJZ]][0-9][ABEHMNPRVWXY])))) [0-9][A-Z-[CIKMOV]]{2})"/>
		</xsd:restriction>
	</xsd:simpleType>
	<!-- PAON Definition as 2000-->
	<xsd:simpleType name="PAONtype">
		<xsd:restriction base="xsd:string">
			<xsd:minLength value="4"/>
			<xsd:pattern value="[0-9 ]{4}[A-Z ]([0-9 ]{4}[A-Z ][0-Z%-+a-z ]{0,90})?"/>
		</xsd:restriction>
	</xsd:simpleType>
	<!-- SAON Definition as 2000-->
	<xsd:simpleType name="SAONtype">
		<xsd:restriction base="xsd:string">
			<xsd:minLength value="4"/>
			<xsd:pattern value="[0-9 ]{4}[A-Z ]([0-9 ]{4}[A-Z ][0-Z%-+a-z ]{0,90})?"/>
		</xsd:restriction>
	</xsd:simpleType>
	<!-- Post Town Definition -->
	<xsd:simpleType name="PostTownType">
		<xsd:restriction base="xsd:string">
			<xsd:minLength value="1"/>
			<xsd:maxLength value="30"/>
		</xsd:restriction>
	</xsd:simpleType>
	<!-- Locality Definition as 2000-->
	<xsd:simpleType name="LocalityType">
		<xsd:restriction base="xsd:string">
			<xsd:minLength value="1"/>
			<xsd:maxLength value="35"/>
		</xsd:restriction>
	</xsd:simpleType>
	<!-- AdministrativeArea Definition as 2000-->
	<xsd:simpleType name="AdministrativeAreaType">
		<xsd:restriction base="xsd:string">
			<xsd:minLength value="1"/>
			<xsd:maxLength value="30"/>
		</xsd:restriction>
	</xsd:simpleType>
	<!-- Town Definition as 2000-->
	<xsd:simpleType name="TownType">
		<xsd:restriction base="xsd:string">
			<xsd:minLength value="1"/>
			<xsd:maxLength value="30"/>
		</xsd:restriction>
	</xsd:simpleType>
	<!-- Street Descriptor as 2000-->
	<xsd:simpleType name="StreetDescriptorType">
		<xsd:restriction base="xsd:string">
			<xsd:minLength value="1"/>
			<xsd:maxLength value="100"/>
		</xsd:restriction>
	</xsd:simpleType>
	<!-- Street Reference Type Definition as 2000-->
	<xsd:simpleType name="StreetReferenceTypeType">
		<xsd:restriction base="xsd:integer">
			<xsd:enumeration value="1"/>
			<xsd:enumeration value="2"/>
			<xsd:enumeration value="3"/>
			<xsd:enumeration value="4"/>
		</xsd:restriction>
	</xsd:simpleType>
	<!-- Version Number Definition as 2000-->
	<xsd:simpleType name="VersionNumberType">
		<xsd:restriction base="xsd:positiveInteger">
			<xsd:minInclusive value="1"/>
			<xsd:maxInclusive value="9999"/>
		</xsd:restriction>
	</xsd:simpleType>
	<!-- Tolerance Definition as 2000-->
	<xsd:simpleType name="ToleranceType">
		<xsd:restriction base="xsd:decimal">
			<xsd:minInclusive value="0"/>
		</xsd:restriction>
	</xsd:simpleType>
	<!-- Reference Point Grid Coordinate Definition required for ESUs -->
	<xsd:simpleType name="RefPointGridCoordinateType">
		<xsd:restriction base="xsd:string">
			<xsd:pattern value="/d{14}"/>
		</xsd:restriction>
	</xsd:simpleType>
	<!-- Type Definition For a BS7666 Street -->
	<xsd:complexType name="StreetStructure">
		<xsd:sequence>
			<xsd:element name="StreetReferenceType" type="StreetReferenceTypeType"/>
			<xsd:element name="StartCoordinate" type="CoordinateStructure"/>
			<xsd:element name="EndCoordinate" type="CoordinateStructure"/>
			<xsd:element name="Tolerance" type="ToleranceType"/>
			<xsd:element name="StreetVersionNumber" type="VersionNumberType"/>
			<xsd:element name="StreetEntryDate" type="xsd:date"/>
			<xsd:element name="StreetClosureDate" type="xsd:date"/>
			<xsd:element name="ResponsibleAuthority" type="CustodianCodeType"/>
			<xsd:element name="DescriptiveIdentifier" type="StreetDescriptiveIdentifierStructure"/>
			<xsd:element name="StreetAlias" type="StreetDescriptiveIdentifierStructure" minOccurs="0"/>
			<xsd:element name="StreetCrossReferences" minOccurs="0">
				<xsd:complexType>
					<xsd:choice>
						<xsd:element name="UNIQUE_STREET_REFERENCE_NUMBERS" type="USRNlistType"/>
						<xsd:element name="ElementaryStreetUnit" type="ElementaryStreetUnitStructure" minOccurs="0" maxOccurs="unbounded"/>
					</xsd:choice>
				</xsd:complexType>
			</xsd:element>
		</xsd:sequence>
		<xsd:attribute name="usrn" type="USRNtype"/>
	</xsd:complexType>
	<!-- Type Definition For a Street Descriptive Identifier 
		 New Construct, contains the street description and
		 at least one of Town, AdministrativeArea or Locality
	 -->
	<xsd:complexType name="StreetDescriptiveIdentifierStructure">
		<xsd:sequence>
			<xsd:element name="StreetDescription" type="StreetDescriptorType"/>
			<xsd:choice>
				<xsd:sequence>
					<xsd:element ref="Locality"/>
					<xsd:choice minOccurs="0">
						<xsd:sequence>
							<xsd:element ref="Town"/>
							<xsd:element ref="AdministrativeArea" minOccurs="0"/>
						</xsd:sequence>
						<xsd:element ref="AdministrativeArea"/>
					</xsd:choice>
				</xsd:sequence>
				<xsd:sequence>
					<xsd:element ref="Town"/>
					<xsd:element ref="AdministrativeArea" minOccurs="0"/>
				</xsd:sequence>
				<xsd:element ref="AdministrativeArea"/>
			</xsd:choice>
		</xsd:sequence>
	</xsd:complexType>
	<!-- BS7666 Elementary Street Unit -->
	<xsd:complexType name="ElementaryStreetUnitStructure">
		<xsd:sequence>
			<xsd:element name="ESUidentity" type="RefPointGridCoordinateType"/>
			<xsd:element name="ESUversion" type="VersionNumberType"/>
			<xsd:element name="ESUentryDate" type="xsd:date"/>
			<xsd:element name="ESUclosureDate" type="xsd:date" minOccurs="0"/>
			<xsd:element name="StartCoordinate" type="CoordinateStructure"/>
			<xsd:element name="EndCoordinate" type="CoordinateStructure"/>
			<xsd:element name="Tolerance" type="ToleranceType"/>
			<xsd:element name="IntermediateCoord" type="CoordinateStructure" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>
	<!-- Coordinate Definition -->
	<xsd:complexType name="CoordinateStructure">
		<xsd:annotation>
			<xsd:documentation>Coordinate Point based on UK National Grid</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element name="X">
				<xsd:annotation>
					<xsd:documentation>Easting Field</xsd:documentation>
				</xsd:annotation>
				<xsd:simpleType>
					<xsd:restriction base="xsd:unsignedLong">
						<xsd:minInclusive value="0"/>
						<xsd:maxInclusive value="999999"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
			<xsd:element name="Y">
				<xsd:annotation>
					<xsd:documentation>Northing Field</xsd:documentation>
				</xsd:annotation>
				<xsd:simpleType>
					<xsd:restriction base="xsd:unsignedLong">
						<xsd:minInclusive value="0"/>
						<xsd:maxInclusive value="9999999"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
		</xsd:sequence>
	</xsd:complexType>
	<!-- Type Definition for a list or UPRN's -->
	<xsd:simpleType name="UPRNlistType">
		<xsd:list itemType="UPRNtype"/>
	</xsd:simpleType>
	<!-- Type Definition for a list or USRN's -->
	<xsd:simpleType name="USRNlistType">
		<xsd:list itemType="USRNtype"/>
	</xsd:simpleType>
	<!-- Polygon representing the extent of a BLPU.   -->
	<xsd:complexType name="BLPUpolygonStructure">
		<xsd:sequence>
			<xsd:element name="PolygonID">
				<xsd:simpleType>
					<xsd:restriction base="xsd:positiveInteger">
						<xsd:minInclusive value="1"/>
						<xsd:maxInclusive value="99"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
			<xsd:element name="PolygonType" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>H to represent a hole or not present</xsd:documentation>
				</xsd:annotation>
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:enumeration value="H"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
			<xsd:choice>
				<xsd:element name="Vertices" type="CoordinateStructure" minOccurs="3" maxOccurs="unbounded"/>
				<xsd:element name="ExternalRef" type="xsd:unsignedLong"/>
			</xsd:choice>
		</xsd:sequence>
	</xsd:complexType>
	<!-- The Extent of a BLPU - expressed either as one or more polygons or external references -->
	<xsd:complexType name="BLPUextentStructure">
		<xsd:sequence>
			<xsd:element name="SourceDescription">
				<xsd:annotation>
					<xsd:documentation>Description of Source of BLPU Extent</xsd:documentation>
				</xsd:annotation>
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:minLength value="1"/>
						<xsd:maxLength value="50"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
			<xsd:element name="ExtentEntryDate" type="xsd:date"/>
			<xsd:element name="ExtentSourceDate" type="xsd:date"/>
			<xsd:element name="ExtentStartDate" type="xsd:date"/>
			<xsd:element name="ExtentEndDate" type="xsd:date" minOccurs="0"/>
			<xsd:element name="ExtentLastUpdateDate" type="xsd:date"/>
			<xsd:element name="ExtentDefinition" type="BLPUpolygonStructure" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>
	<!-- BS7666 Provenance Code -->
	<xsd:simpleType name="ProvenanceCodeType">
		<xsd:annotation>
			<xsd:documentation>Provenance Code values
					T = Registered land title
					L = Unregistered land title
					F = Formal tenancy agreement
					R = Rental agreement
					P = Physical features
					O = Occupancy
					U = Use</xsd:documentation>
		</xsd:annotation>
		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="T"/>
			<xsd:enumeration value="L"/>
			<xsd:enumeration value="F"/>
			<xsd:enumeration value="R"/>
			<xsd:enumeration value="P"/>
			<xsd:enumeration value="O"/>
			<xsd:enumeration value="U"/>
		</xsd:restriction>
	</xsd:simpleType>
	<!-- BS7666 Provenance for a BLPU -->
	<xsd:complexType name="ProvenanceStructure">
		<xsd:sequence>
			<xsd:element name="ProvenanceCode" type="ProvenanceCodeType"/>
			<xsd:element name="Annotation" type="xsd:string"/>
			<xsd:element name="ProvEntryDate" type="xsd:date"/>
			<xsd:element name="ProvStartDate" type="xsd:date"/>
			<xsd:element name="ProvEndDate" type="xsd:date" minOccurs="0"/>
			<xsd:element name="ProvLastUpdateDate" type="xsd:date"/>
			<xsd:element name="BLPUextent" type="BLPUextentStructure" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>
	<!-- Custodian Code - 4 digit code identifier for a particular local authority or other custodian -->
	<xsd:simpleType name="CustodianCodeType">
		<xsd:restriction base="xsd:integer">
			<xsd:minInclusive value="1"/>
			<xsd:maxInclusive value="9999"/>
		</xsd:restriction>
	</xsd:simpleType>
	<!-- Representative Point Code -->
	<xsd:simpleType name="RepresentativePointCodeType">
		<xsd:annotation>
			<xsd:documentation>Representative Point Code values
					1 = Visual centre
					2 = General internal point
					3 = South-west corner of 100m grid square
					4 = Start point of the referenced street</xsd:documentation>
		</xsd:annotation>
		<xsd:restriction base="xsd:positiveInteger">
			<xsd:enumeration value="1"/>
			<xsd:enumeration value="2"/>
			<xsd:enumeration value="3"/>
			<xsd:enumeration value="4"/>
		</xsd:restriction>
	</xsd:simpleType>
	<!-- Logical Status for an LPI and BLPU-->
	<xsd:simpleType name="LogicalStatusType">
		<xsd:annotation>
			<xsd:documentation>Logical Status values
					1 = Approved preferred
					2 = Approved alternative (LPI Only)
					3 = Alternative (LPI Only)
					5 = Candidate
					6 = Provisional
					8 = Historical
					9 = Rejected</xsd:documentation>
		</xsd:annotation>
		<xsd:restriction base="xsd:integer">
			<xsd:minInclusive value="1"/>
			<xsd:maxInclusive value="9"/>
			<xsd:enumeration value="1"/>
			<xsd:enumeration value="2"/>
			<xsd:enumeration value="3"/>
			<xsd:enumeration value="5"/>
			<xsd:enumeration value="6"/>
			<xsd:enumeration value="8"/>
			<xsd:enumeration value="9"/>
		</xsd:restriction>
	</xsd:simpleType>
	<!-- 2000 - Basic Land And Property Unit -->
	<xsd:complexType name="BasicLandAndPropertyUnitStructure">
		<xsd:sequence>
			<xsd:element ref="UniquePropertyReferenceNumber"/>
			<xsd:element name="CustodianCode" type="CustodianCodeType"/>
			<xsd:element name="RepresentativePointCode" type="RepresentativePointCodeType"/>
			<xsd:element name="LogicalStatus" type="LogicalStatusType"/>
			<xsd:element name="GridReference" type="CoordinateStructure"/>
			<xsd:element name="BLPUentryDate" type="xsd:date"/>
			<xsd:element name="BLPUstartDate" type="xsd:date"/>
			<xsd:element name="BLPUendDate" type="xsd:date" minOccurs="0"/>
			<xsd:element name="BLPUlastUpdateDate" type="xsd:date"/>
			<xsd:element name="LandAndPropertyIdentifier" type="LandAndPropertyIdentifierStructure" maxOccurs="unbounded"/>
			<xsd:element name="Provenance" type="ProvenanceStructure" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>
	<!-- 2000 - Land and Property Identifier -->
	<xsd:complexType name="LandAndPropertyIdentifierStructure">
		<xsd:sequence>
			<xsd:element name="PAON" type="PAONtype"/>
			<xsd:element name="SAON" type="SAONtype" minOccurs="0"/>
			<xsd:element name="PostTown" type="PostTownType" minOccurs="0"/>
			<xsd:element name="PostCode" type="PostCodeType" minOccurs="0"/>
			<xsd:element name="Level" minOccurs="0">
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:minLength value="1"/>
						<xsd:maxLength value="30"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
			<xsd:element name="LogicalStatus" type="LogicalStatusType"/>
			<xsd:element name="OfficialAddressMarker" type="xsd:boolean" minOccurs="0"/>
			<xsd:element name="LPIstartDate" type="xsd:date"/>
			<xsd:element name="LPIentryDate" type="xsd:date"/>
			<xsd:element name="LPIendDate" type="xsd:date" minOccurs="0"/>
			<xsd:element name="LPIlastUpdateDate" type="xsd:date"/>
			<xsd:choice>
				<xsd:element name="Street" type="StreetStructure"/>
				<xsd:element name="USRN" type="USRNtype"/>
			</xsd:choice>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:element name="Town" type="TownType"/>
	<xsd:element name="Locality" type="LocalityType"/>
	<xsd:element name="AdministrativeArea" type="AdministrativeAreaType"/>
	<xsd:element name="UniquePropertyReferenceNumber" type="UPRNtype"/>
	<xsd:element name="BS7666Address" type="BSaddressStructure"/>
	<xsd:element name="BS7666BLPU" type="BasicLandAndPropertyUnitStructure"/>
</xsd:schema>
