﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="SimpleHierarchy"
    targetNamespace="http://software.speciesfile.org/ws/SimpleHierarchy.xsd"
    elementFormDefault="qualified"
    xmlns="http://software.speciesfile.org/ws/SimpleHierarchy.xsd"
    xmlns:mstns="http://software.speciesfile.org/ws/SimpleHierarchy.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
	<xs:element name="Hierarchy">
		<xs:annotation>
			<xs:documentation>
				Listing of all taxonomic names within the primary scope of the species file excluding 
				any that are restricted by AccessCode such as manuscript names not yet published.
			</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element name="RootName">
					<xs:complexType>
						<xs:sequence>
							<xs:element ref="PreviousName" minOccurs="0" maxOccurs="unbounded"/>
						</xs:sequence>
						<xs:attribute name="Name" type="xs:string" use="required">
							<xs:annotation>
								<xs:documentation>
									The single name such as species name without genus.
								</xs:documentation>
							</xs:annotation>
						</xs:attribute>
						<xs:attribute name="FullName" type="xs:string" use="optional">
							<xs:annotation>
								<xs:documentation>
									The full name including authority when available.
								</xs:documentation>
							</xs:annotation>
						</xs:attribute>
						<xs:attribute name="ID" type="xs:int" use="required"/>
						<xs:attribute name="Status" use="required">
							<xs:simpleType>
								<xs:restriction base="xs:string">
									<xs:enumeration value="valid"/>
									<xs:enumeration value="temporary"/>
								</xs:restriction>
							</xs:simpleType>
						</xs:attribute>
						<xs:attribute name="Extinct" use="optional">
							<xs:simpleType>
								<xs:restriction base="xs:string">
									<xs:enumeration value="true"/>
								</xs:restriction>
							</xs:simpleType>
						</xs:attribute>
						<xs:attribute name="Rank" type="xs:string" use="required"/>
					</xs:complexType>
				</xs:element>
				<xs:element name="TaxonName" minOccurs="0" maxOccurs="unbounded">
					<xs:complexType>
						<xs:sequence>
							<xs:element ref="PreviousName"  minOccurs="0" maxOccurs="unbounded"/>
						</xs:sequence>
						<xs:attribute name="Name" type="xs:string" use="required">
							<xs:annotation>
								<xs:documentation>
									The single name such as species name without genus.
								</xs:documentation>
							</xs:annotation>
						</xs:attribute>
						<xs:attribute name="FullName" type="xs:string" use="optional">
							<xs:annotation>
								<xs:documentation>
									The full name including authority when available.
								</xs:documentation>
							</xs:annotation>
						</xs:attribute>
						<xs:attribute name="ID" type="xs:int" use="required"/>
						<xs:attribute name="AboveID" type="xs:int" use="required"/>
						<xs:attribute name="Status" use="required">
							<xs:simpleType>
								<xs:restriction base="xs:string">
									<xs:enumeration value="valid"/>
									<xs:enumeration value="temporary">
										<xs:annotation>
											<xs:documentation>
												This includes junior homonyms and unavailable names not yet replaced.
											</xs:documentation>
										</xs:annotation>
									</xs:enumeration>
									<xs:enumeration value="nomen nudum"/>
									<xs:enumeration value="nomen dubium"/>
									<xs:enumeration value="synonym"/>
								</xs:restriction>
							</xs:simpleType>
						</xs:attribute>
						<xs:attribute name="Extinct" use="optional">
							<xs:simpleType>
								<xs:restriction base="xs:string">
									<xs:enumeration value="true"/>
								</xs:restriction>
							</xs:simpleType>
						</xs:attribute>
						<xs:attribute name="Rank" type="xs:string" use="optional"/>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="PreviousName">
		<xs:annotation>
			<xs:documentation>
				This applies only to names at genus rank or lower.  For species-group names it is the binomial.
				For names above species rank but not above genus rank, it is the genus name and subgenus if present.
			</xs:documentation>
		</xs:annotation>
	</xs:element>
</xs:schema>
