<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="http://purl.org/atom/ns#" elementFormDefault="qualified" attributeFormDefault="unqualified"
	xmlns:atom="http://purl.org/atom/ns#" xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:annotation>
		<xs:documentation>
			This version of the Atom API schema is based on version 0.3 of the Atom API specification, 
			found here http://bitworking.org/projects/atom/draft-gregorio-09.html.
		</xs:documentation>
	</xs:annotation>
	<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/03/xml.xsd" />
	<xs:element name="feed" type="atom:feedType">
		<xs:annotation>
			<xs:documentation>
				The Atom feed is defined here 
				http://www.mnot.net/drafts/draft-nottingham-atom-format-02.html.
			</xs:documentation>
		</xs:annotation>
	</xs:element>
	<xs:complexType name="feedType">
		<xs:sequence>
			<xs:choice maxOccurs="unbounded">
				<xs:element name="title" type="atom:contentType" /> 
				<xs:element name="link" type="atom:linkType" /> 
				<xs:element name="author" type="atom:authorType" /> 
				<xs:element name="contributor" type="atom:authorType" /> 
				<xs:element name="tagline" type="atom:contentType" /> 
				<xs:element name="id" type="xs:anyURI" /> 
				<xs:element name="generator" type="atom:generatorType" /> 
				<xs:element name="copyright" type="xs:string" /> 
				<xs:element name="info" type="atom:contentType" /> 
				<xs:element name="modified" type="atom:iso8601dateTime" /> 
			</xs:choice>
			<xs:element name="entry" type="atom:entryType" minOccurs="0" maxOccurs="unbounded" /> 
		</xs:sequence>
		<xs:attribute name="version" type="atom:versionType" use="required" /> 
		<xs:attribute ref="xml:lang" use="optional" />
   	</xs:complexType>
	<xs:element name="entry" type="atom:entryType">
		<xs:annotation>
			<xs:documentation>
				The Atom entry is defined here 
				http://bitworking.org/projects/atom/draft-gregorio-09.html#rfc.section.5.5.
			</xs:documentation>
		</xs:annotation>
	</xs:element>
	<xs:complexType name="entryType">
		<xs:sequence>
			<xs:choice maxOccurs="unbounded">
				<xs:element name="title" type="atom:contentType" />
				<xs:element name="link" type="atom:linkType" />
				<xs:element name="author" type="atom:authorType" />
				<xs:element name="contributor" type="atom:authorType" />
				<xs:element name="id" type="xs:string" />
				<xs:element name="modified" type="atom:iso8601dateTime" />
				<xs:element name="issued" type="atom:iso8601dateTime" />
				<xs:element name="created" type="atom:iso8601dateTime" />
				<xs:element name="summary" type="atom:contentType" />
				<xs:element name="generator" type="atom:generatorType" />
				<xs:element name="content" type="atom:contentType" />
			</xs:choice>
		</xs:sequence>
		<xs:attribute name="version" type="atom:versionType" use="required" /> 
		<xs:attribute ref="xml:lang" use="optional" />
	</xs:complexType>
	<xs:complexType name="contentType" mixed="true">
		<xs:annotation>
			<xs:documentation>
				The Atom content construct is defined here 
				http://www.mnot.net/drafts/draft-nottingham-atom-format-02.html#rfc.section.3.1
				in the syntax specification.
			</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
		</xs:sequence>
		<xs:attribute name="type" use="optional" default="text/plain" />
		<xs:attribute name="mode" use="optional" default="xml">
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="xml" />
					<xs:enumeration value="escaped" />
					<xs:enumeration value="base64" />
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute ref="xml:lang" use="optional" />
	</xs:complexType>
	<xs:complexType name="authorType">
		<xs:annotation>
			<xs:documentation>
				The Atom person construct is defined here
				http://www.mnot.net/drafts/draft-nottingham-atom-format-02.html#rfc.section.3.2
				in the syntax specification.
			</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="name" type="xs:string" />
			<xs:element name="url" type="xs:anyURI" minOccurs="0" maxOccurs="1" />
			<xs:element name="email" type="atom:emailType" minOccurs="0" maxOccurs="1" />
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="linkType">
		<xs:annotation>
			<xs:documentation>
				The Atom link construct is defined here
				http://bitworking.org/projects/atom/draft-gregorio-09.html#rfc.section.5.4
				in the API specification.
			</xs:documentation>
		</xs:annotation>
		<xs:attribute name="rel" use="required">
			<xs:simpleType>
				<xs:restriction base="xs:token">
					<xs:enumeration value="alternate" />
					<xs:enumeration value="start" />
					<xs:enumeration value="next" />
					<xs:enumeration value="prev" />
					<xs:enumeration value="service.edit" />
					<xs:enumeration value="service.post" />
					<xs:enumeration value="service.feed" />
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="type" use="required" type="xs:string" />
		<xs:attribute name="href" use="required" type="xs:anyURI" />
		<xs:attribute name="title" use="optional" type="xs:string" />
	</xs:complexType>
	<xs:complexType name="generatorType">
		<xs:annotation>
			<xs:documentation>
				The Atom generator element is defined here
				http://www.mnot.net/drafts/draft-nottingham-atom-format-02.html#rfc.section.4.9
				in the syntax specification.
			</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="url" use="optional" type="xs:anyURI" />
				<xs:attribute name="version" use="optional" type="xs:string" />
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:simpleType name="iso8601dateTime">
		<xs:annotation>
			<xs:documentation>
				The Atom date construct is defined here
				http://www.mnot.net/drafts/draft-nottingham-atom-format-02.html#rfc.section.3.3
				in the syntax specification.
			</xs:documentation>
		</xs:annotation>
		<xs:union memberTypes="xs:dateTime xs:date" />
	</xs:simpleType>
	<xs:simpleType name="versionType">
		<xs:annotation>
			<xs:documentation>
				General description for a version number.
			</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:normalizedString">
			<xs:pattern value="\d+\.\d+" />
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="emailType">
		<xs:annotation>
			<xs:documentation>
				Schema definition for an email address.
			</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:normalizedString">
			<xs:pattern value="\w+@(\w+\.)+\w+" />
		</xs:restriction>
	</xs:simpleType>
</xs:schema>
