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

	<xs:import namespace="http://www.opengis.net/gml"
		schemaLocation="http://www.ogcnetwork.net/schemas/georss/1.1/gmlgeorss.xsd" />

	<!-- response to a DescribeFeatureType request -->
	<xs:element name="FeatureDescription">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="bxfs:Description" minOccurs="0" />
				<xs:element ref="gml:Envelope" minOccurs="0" />
				<xs:element ref="bxfs:Properties" />
			</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.1.0" />
		</xs:complexType>
	</xs:element>

	<!-- response to a GetFeature request, i.e. the data -->
	<xs:element name="FeatureCollection">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="bxfs:Description" minOccurs="0" />
				<xs:element ref="gml:Envelope" minOccurs="0" />
				<xs:element ref="bxfs:Properties" />
				<xs:element ref="bxfs:Feature" minOccurs="0" maxOccurs="unbounded" />
			</xs:sequence>
			<!-- spec version number -->
			<xs:attribute name="version" type="xs:string" use="required" fixed="0.1.0" />
			<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="bxfs: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 -->
			<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="double" />
						<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="bxfs:Description" minOccurs="0" />
				<xs:element name="Val" type="bxfs: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:schema>

