<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xrd="xri://$xrd*($v*2.0)" targetNamespace="xri://$xrd*($v*2.0)" elementFormDefault="qualified">
	<!-- Utility patterns -->
	<xs:attributeGroup name="otherattribute">
		<xs:anyAttribute namespace="##other" processContents="lax"/>
	</xs:attributeGroup>
	<xs:group name="otherelement">
		<xs:choice>
			<xs:any namespace="##other" processContents="lax"/>
			<xs:any namespace="##local" processContents="lax"/>
		</xs:choice>
	</xs:group>
	<xs:attributeGroup name="priorityAttrGrp">
		<xs:attribute name="priority" type="xs:nonNegativeInteger" use="optional"/>
	</xs:attributeGroup>
	<xs:attributeGroup name="codeAttrGrp">
		<xs:attribute name="code" type="xs:int" use="required"/>
	</xs:attributeGroup>
	<xs:attributeGroup name="verifyAttrGrp">
		<xs:attribute name="cid" use="optional">
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="absent"/>
					<xs:enumeration value="off"/>
					<xs:enumeration value="verified"/>
					<xs:enumeration value="failed"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="ceid" use="optional">
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="absent"/>
					<xs:enumeration value="off"/>
					<xs:enumeration value="verified"/>
					<xs:enumeration value="failed"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
	</xs:attributeGroup>
	<xs:attributeGroup name="selectionAttrGrp">
		<xs:attribute name="match" use="optional" default="default">
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="default"/>
					<xs:enumeration value="any"/>
					<xs:enumeration value="non-null"/>
					<xs:enumeration value="null"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="select" type="xs:boolean" use="optional" default="false"/>
	</xs:attributeGroup>
	<xs:attributeGroup name="appendAttrGrp">
		<xs:attribute name="append" use="optional" default="none">
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="none"/>
					<xs:enumeration value="local"/>
					<xs:enumeration value="authority"/>
					<xs:enumeration value="path"/>
					<xs:enumeration value="query"/>
					<xs:enumeration value="qxri"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
	</xs:attributeGroup>
	<xs:complexType name="URIPattern">
		<xs:simpleContent>
			<xs:extension base="xs:anyURI">
				<xs:attributeGroup ref="xrd:otherattribute"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="URIPriorityPattern">
		<xs:simpleContent>
			<xs:extension base="xrd:URIPattern">
				<xs:attributeGroup ref="xrd:priorityAttrGrp"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="URIPriorityAppendPattern">
		<xs:simpleContent>
			<xs:extension base="xrd:URIPriorityPattern">
				<xs:attributeGroup ref="xrd:appendAttrGrp"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="StringPattern">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attributeGroup ref="xrd:otherattribute"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="StringSelectionPattern">
		<xs:simpleContent>
			<xs:extension base="xrd:StringPattern">
				<xs:attributeGroup ref="xrd:selectionAttrGrp"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<!-- Patterns for elements -->
	<xs:element name="XRD">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="xrd:Query" minOccurs="0"/>
				<xs:element ref="xrd:Status" minOccurs="0"/>
				<xs:element ref="xrd:ServerStatus" minOccurs="0"/>
				<xs:element ref="xrd:Expires" minOccurs="0"/>
				<xs:element ref="xrd:ProviderID" minOccurs="0"/>
				<xs:choice>
					<xs:element ref="xrd:Redirect" minOccurs="0" maxOccurs="unbounded"/>
					<xs:element ref="xrd:Ref" minOccurs="0" maxOccurs="unbounded"/>
				</xs:choice>
				<xs:element ref="xrd:LocalID" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element ref="xrd:EquivID" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element ref="xrd:CanonicalID" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element ref="xrd:CanonicalEquivID" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element ref="xrd:Service" minOccurs="0" maxOccurs="unbounded"/>
				<xs:group ref="xrd:otherelement" minOccurs="0" maxOccurs="unbounded"/>
			</xs:sequence>
			<xs:attribute name="idref" type="xs:IDREF" use="optional"/>
			<xs:attribute name="version" type="xs:string" use="optional" fixed="2.0"/>
			<xs:attributeGroup ref="xrd:otherattribute"/>
		</xs:complexType>
	</xs:element>
	<xs:element name="Query" type="xrd:StringPattern"/>
	<xs:element name="Status">
		<xs:complexType>
			<xs:simpleContent>
				<xs:extension base="xrd:StringPattern">
					<xs:attributeGroup ref="xrd:codeAttrGrp"/>
					<xs:attributeGroup ref="xrd:verifyAttrGrp"/>
					<xs:attributeGroup ref="xrd:otherattribute"/>
				</xs:extension>
			</xs:simpleContent>
		</xs:complexType>
	</xs:element>
	<xs:element name="ServerStatus">
		<xs:complexType>
			<xs:simpleContent>
				<xs:extension base="xrd:StringPattern">
					<xs:attributeGroup ref="xrd:codeAttrGrp"/>
					<xs:attributeGroup ref="xrd:otherattribute"/>
				</xs:extension>
			</xs:simpleContent>
		</xs:complexType>
	</xs:element>
	<xs:element name="Expires">
		<xs:complexType>
			<xs:simpleContent>
				<xs:extension base="xs:dateTime">
					<xs:attributeGroup ref="xrd:otherattribute"/>
				</xs:extension>
			</xs:simpleContent>
		</xs:complexType>
	</xs:element>
	<xs:element name="ProviderID" type="xrd:URIPattern"/>
	<xs:element name="Redirect" type="xrd:URIPriorityAppendPattern"/>
	<xs:element name="Ref" type="xrd:URIPriorityPattern"/>
	<xs:element name="LocalID">
		<xs:complexType>
			<xs:simpleContent>
				<xs:extension base="xrd:StringPattern">
					<xs:attributeGroup ref="xrd:priorityAttrGrp"/>
				</xs:extension>
			</xs:simpleContent>
		</xs:complexType>
	</xs:element>
	<xs:element name="EquivID" type="xrd:URIPriorityPattern"/>
	<xs:element name="CanonicalID" type="xrd:URIPriorityPattern"/>
	<xs:element name="CanonicalEquivID" type="xrd:URIPriorityPattern"/>
	<xs:element name="Service">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="xrd:ProviderID" minOccurs="0"/>
				<xs:element ref="xrd:Type" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element ref="xrd:Path" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element ref="xrd:MediaType" minOccurs="0" maxOccurs="unbounded"/>
				<xs:choice>
					<xs:element ref="xrd:URI" minOccurs="0" maxOccurs="unbounded"/>
					<xs:element ref="xrd:Redirect" minOccurs="0" maxOccurs="unbounded"/>
					<xs:element ref="xrd:Ref" minOccurs="0" maxOccurs="unbounded"/>
				</xs:choice>
				<xs:element ref="xrd:LocalID" minOccurs="0" maxOccurs="unbounded"/>
				<xs:group ref="xrd:otherelement" minOccurs="0" maxOccurs="unbounded"/>
			</xs:sequence>
			<xs:attributeGroup ref="xrd:priorityAttrGrp"/>
			<xs:attributeGroup ref="xrd:otherattribute"/>
		</xs:complexType>
	</xs:element>
	<xs:element name="Type">
		<xs:complexType>
			<xs:simpleContent>
				<xs:extension base="xrd:URIPattern">
					<xs:attributeGroup ref="xrd:selectionAttrGrp"/>
				</xs:extension>
			</xs:simpleContent>
		</xs:complexType>
	</xs:element>
	<xs:element name="Path" type="xrd:StringSelectionPattern"/>
	<xs:element name="MediaType" type="xrd:StringSelectionPattern"/>
	<xs:element name="URI" type="xrd:URIPriorityAppendPattern"/>
</xs:schema>
