<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2006 sp1 U (http://www.altova.com) by Ben Stokes (Scottish Qualifications Authority) -->
<!-- edited with XMLSPY v5 rel. 2 U (http://www.xmlspy.com) by Iain Dick (Edina Software Ltd.) -->
<!-- edited with XML Spy v4.3 U (http://www.xmlspy.com) by Iain Dick (Edina Software Ltd.) -->
<xs:schema xmlns:sqa="http://www.sqa.org.uk/schemas/reur" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.sqa.org.uk/schemas/reur" elementFormDefault="qualified" attributeFormDefault="unqualified">
	<!--A simple type library for the REUR schema based on the current database structure and validation rules-->
	<xs:simpleType name="SQAProductCodeSimpleType">
		<xs:annotation>
			<xs:documentation>grouping or unit code</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="4" fixed="false"/>
			<xs:maxLength value="4"/>
			<xs:pattern value="[A-Z0-9]{4}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="SQAProductLevelSimpleType">
		<xs:annotation>
			<xs:documentation>grouping or unit level</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="2"/>
			<xs:maxLength value="2"/>
			<xs:pattern value="[0-9]{2}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="ScottishCandidateNumberSimpleType">
		<xs:annotation>
			<xs:documentation>scottish candidate number</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:maxLength value="9"/>
			<xs:minLength value="9"/>
			<xs:pattern value="[0-9]{9}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="PersonDateOfBirthSimpleType">
		<xs:annotation>
			<xs:documentation>date of birth</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:date"/>
	</xs:simpleType>
	<xs:simpleType name="PersonForenameSimpleType">
		<xs:annotation>
			<xs:documentation>a persons forename(s)</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:maxLength value="30"/>
			<xs:minLength value="2"/>
			<xs:pattern value="[A-Za-z.,:; \-'\\/ÿýüûúùøöõôóòñïîíìëêéèçåäãâáàÝÜÛÚÙØÖÕÔÓÒÑÏÎÍÌËÊÉÈÇÅÄÃÂÁÀ]{2,30}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="PersonSurnameSimpleType">
		<xs:annotation>
			<xs:documentation>a persons surname</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:maxLength value="30"/>
			<xs:minLength value="1"/>
			<xs:pattern value="[A-Za-z.,:; \-'\\/ÿýüûúùøöõôóòñïîíìëêéèçåäãâáàÝÜÛÚÙØÖÕÔÓÒÑÏÎÍÌËÊÉÈÇÅÄÃÂÁÀ]{1,30}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="PersonSexSimpleType">
		<xs:annotation>
			<xs:documentation>a persons sex</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:enumeration value="f"/>
			<xs:enumeration value="m"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="UKAddressPostCodeSimpleType">
		<xs:annotation>
			<xs:documentation>UK postcode</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="(GIR 0AA)|((([A-Z][0-9][0-9]?)|(([A-Z][A-HJ-Y][0-9][0-9]?)|(([A-Z][0-9][A-Z])|([A-Z][A-HJ-Y][0-9]?[A-Z])))) [0-9][A-Z]{2})|(BFPO [0-9][0-9][0-9]?)"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="BFPOAddressPostCodeSimpleType">
		<xs:annotation>
			<xs:documentation>British Forces postcode</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="BFPO [0-9][0-9][0-9]?"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="SQACentreCodeSimpleType">
		<xs:annotation>
			<xs:documentation>a centre code</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="7"/>
			<xs:maxLength value="7"/>
			<xs:pattern value="[0-9]{7}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="AddressCountrySimpleType">
		<xs:annotation>
			<xs:documentation>a country</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="[A-Za-z \-',.;:\\/\(\)]{1,60}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="AddressLineSimpleType">
		<xs:annotation>
			<xs:documentation>an address line</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="1"/>
			<xs:maxLength value="30"/>
			<xs:pattern value="[A-Za-z ,.;:\-'\\/\(\)@0-9&#0035;&#0034;&#0038;ÿýüûúùøöõôóòñïîíìëêéèçåäãâáàÝÜÛÚÙØÖÕÔÓÒÑÏÎÍÌËÊÉÈÇÅÄÃÂÁÀ]{1,30}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="SQAOutputSimpleType">
		<xs:annotation>
			<xs:documentation>The output type of the file</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="(HTML|XML|Excel){1}(,HTML|,XML|,Excel)?(,HTML|,XML|,Excel)?"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="SQAProductCompletionDateSimpleType">
		<xs:annotation>
			<xs:documentation>a completion date</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:date"/>
	</xs:simpleType>
	<xs:simpleType name="SQAProductResultSimpleType">
		<xs:annotation>
			<xs:documentation>a result</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:enumeration value="A"/>
			<xs:enumeration value="B"/>
			<xs:enumeration value="C"/>
			<xs:enumeration value="F"/>
			<xs:enumeration value="M"/>
			<xs:enumeration value="P"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="RegistrationStageSimpleType">
		<xs:annotation>
			<xs:documentation> a registration stage</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:integer">
			<xs:totalDigits value="1"/>
			<xs:enumeration value="1"/>
			<xs:enumeration value="2"/>
			<xs:enumeration value="3"/>
			<xs:enumeration value="4"/>
			<xs:enumeration value="5"/>
			<xs:enumeration value="6"/>
			<xs:enumeration value="7"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="SimpleRegistrationEthnicityType">
		<xs:annotation>
			<xs:documentation> a candidates ethnicity</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:integer"/>
	</xs:simpleType>
        <xs:simpleType name="UnifiedLearnersNumberSimpleType">
		<xs:annotation>
			<xs:documentation> a candidates unified learners number</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:maxLength value="10"/>
			<xs:minLength value="10"/>
			<xs:pattern value="[1-9][0-9]{9}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="REURErrorType">
		<xs:annotation>
			<xs:documentation> an error string</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string"/>
	</xs:simpleType>
	<xs:simpleType name="VerificationIDType">
		<xs:annotation>
			<xs:documentation>the VID associated with a registration</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string"/>
	</xs:simpleType>
	<xs:complexType name="SQAProductCodeType">
		<xs:annotation>
			<xs:documentation>grouping or unit code with error attribute</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="sqa:SQAProductCodeSimpleType">
				<xs:attribute name="error" type="sqa:REURErrorType" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="SQAProductLevelType">
		<xs:annotation>
			<xs:documentation>grouping or unit level with error attribute</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="sqa:SQAProductLevelSimpleType">
				<xs:attribute name="error" type="sqa:REURErrorType" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="ScottishCandidateNumberType">
		<xs:annotation>
			<xs:documentation>scottish candidate number with error attribute</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="sqa:ScottishCandidateNumberSimpleType">
				<xs:attribute name="error" type="sqa:REURErrorType" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="PersonDateOfBirthType">
		<xs:annotation>
			<xs:documentation>date of birth with error attribute</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="sqa:PersonDateOfBirthSimpleType">
				<xs:attribute name="error" type="sqa:REURErrorType" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="PersonForenameType">
		<xs:annotation>
			<xs:documentation>a persons forename(s) with error attribute</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="sqa:PersonForenameSimpleType">
				<xs:attribute name="error" type="sqa:REURErrorType" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="PersonSurnameType">
		<xs:annotation>
			<xs:documentation>a persons surname with error attribute</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="sqa:PersonSurnameSimpleType">
				<xs:attribute name="error" type="sqa:REURErrorType" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="PersonSexType">
		<xs:annotation>
			<xs:documentation>a persons sex with error attribute</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="sqa:PersonSexSimpleType">
				<xs:attribute name="error" type="sqa:REURErrorType" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="UKAddressPostCodeType">
		<xs:annotation>
			<xs:documentation>UK postcode with error attribute</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="sqa:UKAddressPostCodeSimpleType">
				<xs:attribute name="error" type="sqa:REURErrorType" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="BFPOAddressPostCodeType">
		<xs:annotation>
			<xs:documentation>British Forces postcode with error attribute</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="sqa:BFPOAddressPostCodeSimpleType">
				<xs:attribute name="error" type="sqa:REURErrorType" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="SQACentreCodeType">
		<xs:annotation>
			<xs:documentation>a centre code with error attribute</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="sqa:SQACentreCodeSimpleType">
				<xs:attribute name="error" type="sqa:REURErrorType" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="AddressCountryType">
		<xs:annotation>
			<xs:documentation>a country with error attribute</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="sqa:AddressCountrySimpleType">
				<xs:attribute name="error" type="sqa:REURErrorType" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="AddressLineType">
		<xs:annotation>
			<xs:documentation>an address line with error attribute</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="sqa:AddressLineSimpleType">
				<xs:attribute name="error" type="sqa:REURErrorType" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="SQAProductResultType">
		<xs:annotation>
			<xs:documentation> a result with error attribute</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="sqa:SQAProductResultSimpleType">
				<xs:attribute name="error" type="sqa:REURErrorType" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="SQAProductCompletionDateType">
		<xs:annotation>
			<xs:documentation> a completion date with error attribute</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="sqa:SQAProductCompletionDateSimpleType">
				<xs:attribute name="error" type="sqa:REURErrorType" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="RegistrationStageType">
		<xs:annotation>
			<xs:documentation> a registration stage with error attribute</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="sqa:RegistrationStageSimpleType">
				<xs:attribute name="error" type="sqa:REURErrorType" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="RegistrationEthnicityType">
		<xs:annotation>
			<xs:documentation> a candidates ethnicity</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="sqa:SimpleRegistrationEthnicityType">
				<xs:attribute name="error" type="sqa:REURErrorType" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
       <xs:complexType name="UnifiedLearnersNumberType">
		<xs:annotation>
			<xs:documentation>unified learners number with error attribute</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="sqa:UnifiedLearnersNumberSimpleType">
				<xs:attribute name="error" type="sqa:REURErrorType" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
</xs:schema>
