<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by Richard Hopkins (University of Edinburgh) -->
<!-- edited with XMLSPY v2004 rel. 4 U (http://www.xmlspy.com) by Richard Hopkins (NeSC) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
	<!--This is an XML level comment - below is Schema level comment-->
	<xs:annotation>
		<xs:documentation>Here is a Schema for Puchase Orders - to illustrate most Schema features</xs:documentation>
	</xs:annotation>
	<xs:annotation>
		<xs:appinfo>Schema level processing instruction</xs:appinfo>
	</xs:annotation>
	<?target-software note="an XML level processing instruction" iInstruction1="how to treat this schema" ?>
	<xs:attribute name="units" default="metric">
		<xs:annotation>
			<xs:documentation>Metric or Imperial</xs:documentation>
		</xs:annotation>
		<xs:simpleType>
			<xs:restriction base="xs:string">
				<xs:enumeration value="imperial"/>
				<xs:enumeration value="metric"/>
			</xs:restriction>
		</xs:simpleType>
	</xs:attribute>
	<xs:simpleType name="dateT">
		<xs:annotation>
			<xs:documentation>DD/MM/YYYY or MM/DD/YYYY</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="\d{2}/\d{2}/\d{2,4}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="prodCodeT">
		<xs:annotation>
			<xs:documentation>Product CodeFormat, e.g AB-1243 or ZYXW-87654321</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:pattern value="[A-Z]{2,4}-\d{4,8}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="accNoT">
		<xs:restriction base="xs:string">
			<xs:minLength value="4"/>
			<xs:maxLength value="10"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="entryT">
		<xs:annotation>
			<xs:documentation>A PO entry for one ordered item</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element ref="note" minOccurs="0"/>
			<xs:element name="prodCode" type="prodCodeT"/>
			<xs:element name="quant">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:decimal">
							<xs:attribute name="units" use="required"/>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
			
		</xs:sequence>
		<xs:attribute name="collect" type="xs:boolean" use="optional" default="false"/>
	</xs:complexType>
	<xs:element name="PO">
		<xs:annotation>
			<xs:documentation>A Purchase Order</xs:documentation>
			<xs:appinfo>How to do it</xs:appinfo>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element name="date">
					<xs:complexType>
						<xs:choice>
							<xs:element name="USdate">
								<xs:simpleType>
									<xs:restriction base="dateT"/>
								</xs:simpleType>
							</xs:element>
							<xs:element name="UKdate" type="dateT"/>
						</xs:choice>
					</xs:complexType>
				</xs:element>
				<xs:element name="accNo" type="accNoT"/>
				<xs:element name="customer" nillable="1">
					<xs:complexType>
						<xs:all>
							<xs:element name="deliver">
								<xs:complexType>
									<xs:sequence>
										<xs:element ref="addr"/>
									</xs:sequence>
								</xs:complexType>
							</xs:element>
							<xs:element name="bill">
								<xs:complexType>
									<xs:sequence>
										<xs:element ref="addr"/>
										<xs:element name="terms">
											<xs:simpleType>
												<xs:restriction base="xs:string">
													<xs:whiteSpace value="collapse"/>
													<xs:enumeration value="7-day"/>
													<xs:enumeration value="28-day"/>
													<xs:enumeration value="end-of--month"/>
												</xs:restriction>
											</xs:simpleType>
										</xs:element>
									</xs:sequence>
								</xs:complexType>
							</xs:element>
						</xs:all>
					</xs:complexType>
				</xs:element>
				<xs:element ref="note" minOccurs="0" maxOccurs="3"/>
				<xs:element name="entry" type="entryT" maxOccurs="unbounded"/>
				<xs:element name="PS" minOccurs="2" maxOccurs="3">
					<xs:annotation>
						<xs:documentation>To illustrate more things</xs:documentation>
					</xs:annotation>
					<xs:complexType>
						<xs:sequence minOccurs="0" maxOccurs="2">
							<xs:element name="ID">
								<xs:annotation>
									<xs:documentation>either a URI or a  hexadecimal unique identifier code - needs type resolutionin the actual document</xs:documentation>
								</xs:annotation>
								<xs:simpleType>
									<xs:union memberTypes="xs:hexBinary xs:anyURI"/>
								</xs:simpleType>
							</xs:element>
							<xs:choice>
								<xs:element name="Percentage">
									<xs:simpleType>
										<xs:restriction base="xs:decimal">
											<xs:fractionDigits value="2"/>
											<xs:totalDigits value="5"/>
											<xs:maxInclusive value="100"/>
											<xs:minInclusive value="0"/>
										</xs:restriction>
									</xs:simpleType>
								</xs:element>
								<xs:element name="fixedLength">
									<xs:simpleType>
										<xs:restriction base="xs:string">
											<xs:length value="4"/>
											<xs:whiteSpace value="preserve"/>
										</xs:restriction>
									</xs:simpleType>
								</xs:element>
							</xs:choice>
							<xs:element name="Memo" minOccurs="0">
								<xs:annotation>
									<xs:documentation>Illustrates mixed content - child elements and simple text data intermingled</xs:documentation>
								</xs:annotation>
								<xs:complexType mixed="true">
									<xs:sequence>
										<xs:element name="To" type="xs:string"/>
										<xs:element name="Re"/>
										<xs:element name="Ref" type="xs:string"/>
										<xs:element name="From"/>
									</xs:sequence>
								</xs:complexType>
							</xs:element>
							<xs:element name="specialItem" type="extendedEntryT" minOccurs="0" maxOccurs="unbounded"/>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="note">
		<xs:annotation>
			<xs:documentation>An annotation on the document</xs:documentation>
		</xs:annotation>
		<xs:simpleType>
			<xs:restriction base="xs:string">
				<xs:minLength value="1"/>
			</xs:restriction>
		</xs:simpleType>
	</xs:element>
	<xs:element name="addr">
		<xs:annotation>
			<xs:documentation>A UK address</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element name="streetAddr">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:minLength value="1"/>
							<xs:maxLength value="50"/>
							<xs:whiteSpace value="preserve"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
				<xs:element name="City">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:minLength value="1"/>
							<xs:maxLength value="50"/>
							<xs:whiteSpace value="preserve"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
				<xs:element name="postCode">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:minLength value="6"/>
							<xs:maxLength value="8"/>
							<xs:whiteSpace value="collapse"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:complexType name="extendedEntryT">
		<xs:complexContent>
			<xs:extension base="entryT">
				<xs:sequence>
					<xs:element name="notify" type="xs:string"/>
					<xs:element name="urgency" minOccurs="0">
						<xs:simpleType>
							<xs:restriction base="xs:string">
								<xs:enumeration value="very urgent"/>
							</xs:restriction>
						</xs:simpleType>
					</xs:element>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
</xs:schema>
