<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.opengis.net/wfss" xmlns:wfss="http://www.opengis.net/wfss"
	xmlns:ows="http://www.opengis.net/ows" xmlns:gml="http://www.opengis.net/gml"
	xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="0.5">

	<!-- imports -->
	<xs:import namespace="http://www.opengis.net/gml"
		schemaLocation="http://georss.org/xml/1.1/gmlgeorss.xsd" />
	<xs:import namespace="http://www.opengis.net/ows"
		schemaLocation="http://schemas.opengis.net/ows/1.0.0/owsAll.xsd" />


	<!-- response to a DescribeFeatureType request -->
	<xs:element name="FeatureDescription">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="wfss:Description" minOccurs="0" />
				<xs:element ref="gml:Envelope" minOccurs="0" />
				<xs:element ref="wfss:Properties" minOccurs="0" />
			</xs:sequence>
			<xs:attribute name="name" type="xs:string" use="optional" />
			<!-- spec version number -->
			<xs:attribute name="version" type="xs:string" use="required" fixed="0.5" />
		</xs:complexType>
	</xs:element>

	<!-- response to a GetFeature request, i.e. the data -->
	<xs:element name="FeatureCollection">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="wfss:Description" minOccurs="0" />
				<xs:element ref="gml:Envelope" minOccurs="0" />
				<xs:element ref="wfss:Properties" minOccurs="0" />
				<xs:element ref="wfss:Feature" minOccurs="0" maxOccurs="unbounded" />
			</xs:sequence>
			<!-- spec version number -->
			<xs:attribute name="version" type="xs:string" use="required" fixed="0.5" />
			<xs:attribute name="name" type="xs:string" use="optional" />
			<xs:attribute name="srsName" type="xs:anyURI" use="optional" />
			<!-- number of features returned from the query. nice hint to clients. -->
			<xs:attribute name="featurecount" type="xs:int" use="optional" />
		</xs:complexType>
	</xs:element>

	<xs:element name="Properties">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="wfss:Property" maxOccurs="unbounded" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>

	<xs:element name="Property">
		<xs:complexType>
			<!-- name is a unique, computer-readable ID/key -->
			<xs:attribute name="name" type="xs:string" use="required" />

			<!-- description of name. good for human comprehension and GUI display -->
			<xs:attribute name="title" type="xs:string" use="optional" />

			<!-- are regex queries supported on this property? -->
			<xs:attribute name="queryable" type="xs:boolean" use="optional" />

			<!-- data type, covers a range of geographic, XML and RDBMS data types -->
			<!-- these map more or less directly to GML Simple Features Level 0    -->
			<xs:attribute name="type" use="optional" default="string">
				<xs:simpleType>
					<xs:restriction base="xs:NMTOKEN">
						<xs:enumeration value="string" />
						<xs:enumeration value="integer" />
						<xs:enumeration value="real" />
						<xs:enumeration value="boolean" />
						<xs:enumeration value="timestamp" />
						<xs:enumeration value="uri" />
						<xs:enumeration value="raw64" />
						<xs:enumeration value="gml:Point" />
						<xs:enumeration value="gml:Line" />
						<xs:enumeration value="gml:Polygon" />
						<xs:enumeration value="gml:Envelope" />
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
			<xs:attribute name="maxLength" type="xs:nonNegativeInteger" use="optional" />
			<xs:attribute name="precision" type="xs:positiveInteger" use="optional" />
			<xs:attribute name="scale" type="xs:integer" use="optional" />
		</xs:complexType>
	</xs:element>

	<!-- Feature - like a record (or row) in a database -->
	<xs:element name="Feature">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="wfss:Description" minOccurs="0" />
				<xs:element name="Val" type="wfss:ValType" maxOccurs="unbounded" />
			</xs:sequence>
			<xs:attribute name="fid" type="xs:anyURI" use="optional" />
		</xs:complexType>
	</xs:element>

	<!-- The content of the Val element is a text string representing -->
	<!-- a STRING, NUMBER, DATE or BOOLEAN, or a GeoRSS GML geometry. -->
	<xs:complexType name="ValType" mixed="true">
		<xs:complexContent mixed="true">
			<xs:extension base="xs:anyType" />
		</xs:complexContent>
	</xs:complexType>

	<!-- Description - a very lightweight structure for attaching metadata to 	-->
	<!-- various elements. More detailed metadata (such as that that may be 	-->
	<!-- stored in a registry) can be referenced by using the MetadataURL 		-->
	<!-- element. The optional standard attribute may be used to indicate the 	-->
	<!-- type of metadata being pointed to. For example, FGDC or ISO19119 		-->
	<!-- or ... The url content is the pointer to the detailed metadata and 	-->
	<!-- may in fact point to metadata stored in a catalog. 					-->
	<xs:element name="Description">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="Title" type="xs:string" minOccurs="0" maxOccurs="1" />
				<xs:element name="Abstract" type="xs:string" minOccurs="0" maxOccurs="1" />
				<xs:element name="MetadataURL" minOccurs="0" maxOccurs="unbounded">
					<xs:complexType>
						<xs:attribute name="url" type="xs:anyURI" use="required" />
						<xs:attribute name="standard" type="xs:anyURI" use="optional" />
					</xs:complexType>
				</xs:element>
				<xs:element ref="gml:Envelope" minOccurs="0" maxOccurs="unbounded" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>

	<xs:element name="WFS_Simple_Capabilities">
		<xs:complexType>
			<xs:annotation>
				<xs:documentation> XML encoded WFS GetCapabilities operation response. This document
					provides clients with service metadata about a specific service instance,
					including metadata about the tightly-coupled data served. If the server does not
					implement the updateSequence parameter, the server shall always return the
					complete Capabilities document, without the updateSequence parameter. When the
					server implements the updateSequence parameter and the GetCapabilities operation
					request included the updateSequence parameter with the current value, the server
					shall return this element with only the "version" and "updateSequence"
					attributes. Otherwise, all optional elements shall be included or not depending
					on the actual value of the Contents parameter in the GetCapabilities operation
					request. </xs:documentation>
			</xs:annotation>
			<xs:complexContent>
				<xs:extension base="ows:CapabilitiesBaseType" />
			</xs:complexContent>
		</xs:complexType>
	</xs:element>

</xs:schema>
