<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:annotation>
		<xs:documentation>
			XML Schema for 2.0 by Randy Charles Morin
		</xs:documentation>
		<xs:documentation>
			I wrote this with a little help from Jorgen Thelin's similar XML schema.
			This schema is more strict, by intention.
		</xs:documentation>
	</xs:annotation>
	<xs:element name="rss" type="rssType">
		<xs:annotation>
			<xs:documentation>Top level element is rss</xs:documentation>
		</xs:annotation>
	</xs:element>
	<xs:complexType name="rssType">
		<xs:sequence>
			<xs:element name="channel" type="channelType"/>
			<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="version" type="xs:decimal" use="required" fixed="2.0"/>
		<xs:anyAttribute namespace="##any"/>
	</xs:complexType>
	<xs:complexType name="channelType">
		<xs:sequence>
			<xs:element name="title" type="xs:string"/>
			<xs:element name="link" type="xs:anyURI"/>
			<xs:element name="description" type="xs:string"/>
			<xs:element name="language" type="xs:language" minOccurs="0"/>
			<xs:element name="copyright" type="xs:string" minOccurs="0"/>
			<xs:element name="managingEditor" type="emailType" minOccurs="0"/>
			<xs:element name="webMaster" type="emailType" minOccurs="0"/>
			<xs:element name="pubDate" type="rfc822Type" minOccurs="0"/>
			<xs:element name="lastBuildDate" type="rfc822Type" minOccurs="0"/>
			<xs:element name="category" type="categoryType" minOccurs="0"/>
			<xs:element name="generator" type="xs:string" minOccurs="0"/>
			<xs:element name="docs" type="xs:anyURI" minOccurs="0"/>
			<xs:element name="cloud" type="cloudType" minOccurs="0"/>
			<xs:element name="ttl" type="xs:nonNegativeInteger" minOccurs="0"/>
			<xs:element name="image" type="imageType" minOccurs="0"/>
			<xs:element name="textInput" type="textInputType" minOccurs="0"/>
			<xs:element name="skipHours" type="skipHoursType" minOccurs="0"/>
			<xs:element name="skipDays" type="skipDaysType" minOccurs="0"/>
			<xs:element name="item" type="itemType" minOccurs="0" maxOccurs="unbounded"/>
			<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:anyAttribute namespace="##any"/>
	</xs:complexType>
	<xs:complexType name="itemType">
		<xs:sequence>
			<xs:element name="title" type="xs:string" minOccurs="0"/>
			<xs:element name="description" type="xs:string" minOccurs="0"/>
			<xs:element name="link" type="xs:anyURI" minOccurs="0"/>
			<xs:element name="author" type="emailType" minOccurs="0"/>
			<xs:element name="category" type="categoryType" minOccurs="0"/>
			<xs:element name="comments" type="xs:anyURI" minOccurs="0"/>
			<xs:element name="enclosure" type="enclosureType" minOccurs="0"/>
			<xs:element name="guid" type="guidType" minOccurs="0"/>
			<xs:element name="pubDate" type="rfc822Type" minOccurs="0"/>
			<xs:element name="source" type="sourceType" minOccurs="0"/>
			<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>

	<xs:complexType name="sourceType">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="url" type="xs:anyURI"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>

	<xs:complexType name="guidType">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="isPermaLink" type="xs:boolean" use="optional" default="true"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	
	<xs:complexType name="enclosureType">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="url" type="xs:anyURI" use="required"/>
				<xs:attribute name="length" type="xs:nonNegativeInteger" use="required"/>
				<xs:attribute name="type" type="xs:string" use="required"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="skipDaysType">
		<xs:sequence>
			<xs:element name="day" minOccurs="0" maxOccurs="7">
				<xs:simpleType>
					<xs:restriction base="xs:string">
						<xs:enumeration value="Monday"/>
						<xs:enumeration value="Tuesday"/>
						<xs:enumeration value="Wednesday"/>
						<xs:enumeration value="Thursday"/>
						<xs:enumeration value="Friday"/>
						<xs:enumeration value="Saturday"/>
						<xs:enumeration value="Sunday"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="skipHoursType">
		<xs:sequence>
			<xs:element name="hour" minOccurs="0" maxOccurs="24">
				<xs:simpleType>
					<xs:restriction base="xs:nonNegativeInteger">
						<xs:minInclusive value="0"/>
						<xs:maxInclusive value="23"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<xs:simpleType name="emailType">
		<xs:restriction base="xs:string">
			<xs:pattern value="([a-zA-Z0-9_\-])([a-zA-Z0-9_\-\.]*)@(\[((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}|((([a-zA-Z0-9\-]+)\.)+))([a-zA-Z]{2,}|(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\])"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="rfc822Type">
		<xs:restriction base="xs:string">
			<xs:pattern value="(((Mon)|(Tue)|(Wed)|(Thu)|(Fri)|(Sat)|(Sun)), *)?\d\d? +((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec)) +\d\d(\d\d)? +\d\d:\d\d(:\d\d)? +(([+\-]?\d\d\d\d)|(UT)|(GMT)|(EST)|(EDT)|(CST)|(CDT)|(MST)|(MDT)|(PST)|(PDT)|\w)"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="categoryType">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="domain" type="xs:string" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="cloudType">
		<xs:attribute name="domain" type="xs:string" use="required"/>
		<xs:attribute name="port" type="xs:positiveInteger" use="required"/>
		<xs:attribute name="path" type="xs:string" use="required"/>
		<xs:attribute name="registerProcedure" type="xs:string" use="required"/>
		<xs:attribute name="protocol" type="xs:string" use="required"/>
	</xs:complexType>
	<xs:complexType name="imageType">
		<xs:all>
			<xs:element name="url" type="xs:anyURI"/>
			<xs:element name="title" type="xs:string"/>
			<xs:element name="link" type="xs:anyURI"/>
			<xs:element name="width" default="88" minOccurs="0">
				<xs:simpleType>
					<xs:restriction base="xs:positiveInteger">
						<xs:maxExclusive value="400"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:element>
			<xs:element name="height" default="31" minOccurs="0">
				<xs:simpleType>
					<xs:restriction base="xs:positiveInteger">
						<xs:maxExclusive value="144"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:element>
			<xs:element name="description" type="xs:string" minOccurs="0"/>
		</xs:all>
	</xs:complexType>
	<xs:complexType name="textInputType">
		<xs:all>
			<xs:element name="title" type="xs:string"/>
			<xs:element name="description" type="xs:string"/>
			<xs:element name="name" type="xs:string"/>
			<xs:element name="link" type="xs:anyURI"/>
		</xs:all>
	</xs:complexType>
</xs:schema>
