<?xml version="1.0" encoding="UTF-8"?>
<!--  File: legend.xsd  -->
<schema targetNamespace="http://www.esri.com/axl" 
        xmlns="http://www.w3.org/2001/XMLSchema" 
        xmlns:axl="http://www.esri.com/axl"
        xmlns:svg="http://www.w3.org/svg">
        
  <!--
  
  	Schema for the definition of legends for the rendering
  	of spatial features.
  	The definition for creating the legend types is taken and 
  	adapted from ESRI's ArcXML. For the explanation of the
  	corrsponding tags see the ArcXML Programmer's Reference Guide
  	http://arconline.esri.com/arconline/documentation/ims_/webhelp31/arcxmlguide.htm.
  	
  	The graphical elements defined with ArcXML are replaced by elements
  	taken from the SVG specification.
  	
  	The actual schema definition is provides only simple renderers. Future
  	versions will allow to define more complex renderers.
  	
  	Author: Martin Braendli
  	
  -->
        
  <!-- bring in the svg definitions -->
  <import namespace="http://www.w3.org/svg" schemaLocation="svg.xsd"/>


	<!-- 
		Root element. A FeatureRendererCollection consists of a list of
		FeatureRenderers. The feature renderers store the information for how
		feature must be rendered.
	-->
	
  <element name="FeatureRendererCollection" type="axl:FeatureRendererCollectionType" />
	
  <complexType name="FeatureRendererCollectionType">
    <sequence>
      <element ref="axl:FeatureRenderer" maxOccurs="unbounded"/>
    </sequence>
  </complexType>


	<!-- 
		A FeatureRenderer is matched with an existing
		FeatureType by using the attribute TypeName. TypeName consist
		of the name of a FeatureType.
	-->

  <element name="FeatureRenderer" type="axl:FeatureRendererType" />
	
  <complexType name="FeatureRendererType">
		<choice minOccurs="0" maxOccurs="unbounded">
			<element ref="axl:SimpleRenderer" />
			<element ref="axl:ValueMapRenderer" />
    		</choice>
    <attribute name="id" type="string" />
    <attribute name="typeName" type="string" use="required" /> 
  </complexType>
  
  
  <!-- Elements for the SimpleRenderer -->

  <element name="SimpleRenderer" type="axl:SimpleRendererType" />
  
  <complexType name="SimpleRendererType">
		<choice maxOccurs="unbounded">
			<element ref="axl:SimpleMarkerSymbol" />
			<element ref="axl:SimpleLineSymbol" />
			<element ref="axl:SimplePolygonSymbol" />
    		</choice>
  </complexType>
  
  
  <!-- Elements for the SimpleMarkerSymbol -->

  <element name="SimpleMarkerSymbol" type="axl:SimpleMarkerSymbolType" />
  
  <complexType name="SimpleMarkerSymbolType">

    <!-- 
    	SimpleMarkerSymbol is based on the svg:marker Element.
    	However, instead of creating the type based on restricting svg:marker
    	we include the elements and attributes necessary for our application:
    		- A subset of elements (see below)
  			- A subset of PresentationAttributes-Color
  			- PresentationAttributes-FillStroke
  	-->
  	
  	<choice minOccurs="0" maxOccurs="unbounded">
			<element ref="svg:desc" />
			<element ref="svg:title" />
			<element ref="svg:defs" />
			<element ref="svg:g" />
			<element ref="svg:path" />
			<element ref="svg:rect" />
			<element ref="svg:circle" />
			<element ref="svg:ellipse" />
			<element ref="svg:line" />
			<element ref="svg:polyline" />
			<element ref="svg:polygon" />
			<element ref="svg:marker" />
    	</choice>
    
		<!-- general attributes -->

    <attribute name="id" type="ID" />
    
    		<!-- PresentationAttributes-Color -->
    <attribute name="color" type="string" />
    
		<!-- PresentationAttributes-FillStroke -->    
    <attribute name="fill" type="string" />
    <attribute name="fill-opacity" type="string" />
    <attribute name="fill-rule" type="svg:fill-ruleType" />
    <attribute name="stroke" type="string" />
    <attribute name="stroke-dasharray" type="string" />
    <attribute name="stroke-dashoffset" type="string" />
    <attribute name="stroke-linecap" type="svg:stroke-linecapType" />
    <attribute name="stroke-linejoin" type="svg:stroke-linejoinType" />>
    <attribute name="stroke-miterlimit" type="string" />
    <attribute name="stroke-opacity" type="string" />
    <attribute name="stroke-width" type="string" />

    <attribute name="marker-start" type="string" />
    <attribute name="marker-mid" type="string" />
    <attribute name="marker-end" type="string" />
    
    		<!-- Marker specific attributes -->

    <attribute name="viewBox" type="string" />
    <attribute name="preserveAspectRatio" type="string" default="xMidYMid meet" />
    <attribute name="refX" type="string" />
    <attribute name="refY" type="string" />
    <attribute name="markerUnits" type="svg:markerUnitsType" />
    <attribute name="markerWidth" type="string" />
    <attribute name="markerHeight" type="string" />
    <attribute name="orient" type="string" />
    
  </complexType>  

  		<!-- Elements for the SimpleLineSymbol -->
  
  <element name="SimpleLineSymbol" type="axl:SimpleLineSymbolType" />
  
 	<complexType name="SimpleLineSymbolType">
 	
    <!-- 
    	SimpleLineSymbolType is based on the svg:g Element.
    	However, instead of creating the type based on restricting svg:g
    	we include the elements and attributes necessary for our application:
    		- A subset of elements (see below)
  			- A subset of PresentationAttributes-Color
  			- PresentationAttributes-FillStroke
  	-->
  	
  	<!-- included elements from svg:g -->
  	
		<choice minOccurs="0" maxOccurs="unbounded">
			<element ref="svg:desc" />
			<element ref="svg:title" />
			<element ref="svg:defs" />
			<element ref="svg:g" />
		</choice>
		
		<!-- general attributes -->
		
    <attribute name="id" type="ID" />
    
    <!-- PresentationAttributes-Color -->
    <attribute name="color" type="string" />

		<!-- PresentationAttributes-FillStroke -->
		
    <attribute name="fill" type="string" />
    <attribute name="fill-opacity" type="string" />
    <attribute name="fill-rule" type="svg:fill-ruleType" />
    <attribute name="stroke" type="string" />
    <attribute name="stroke-dasharray" type="string" />
    <attribute name="stroke-dashoffset" type="string" />
    <attribute name="stroke-linecap" type="svg:stroke-linecapType" />
    <attribute name="stroke-linejoin" type="svg:stroke-linejoinType" />
    <attribute name="stroke-miterlimit" type="string" />
    <attribute name="stroke-opacity" type="string" />
    <attribute name="stroke-width" type="string" />
    
    <!-- Attributes for transformations -->
    
    <attribute name="transform" type="string" />
  	
 	</complexType>
	  


  <!-- Elements for the SimplePolygonSymbol -->
  
  <element name="SimplePolygonSymbol" type="axl:SimplePolygonSymbolType" />
  
 	<complexType name="SimplePolygonSymbolType">
 	
    <!-- 
    	SimplePolygonSymbolType is based on the svg:g Element.
    	However, instead of creating the type based on restricting svg:g
    	we include the elements and attributes necessary for our application:
    		- A subset of elements (see below)
  			- A subset of PresentationAttributes-Color
  			- PresentationAttributes-FillStroke
  	-->
  	
  	<!-- included elements from svg:g -->
  	
		<choice minOccurs="0" maxOccurs="unbounded">
			<element ref="svg:desc" />
			<element ref="svg:title" />
			<element ref="svg:defs" />
			<element ref="svg:g" />
		</choice>
		
		<!-- general attributes -->
		
    <attribute name="id" type="ID" />
    
    <!-- PresentationAttributes-Color -->
    <attribute name="color" type="string" />

		<!-- PresentationAttributes-FillStroke -->
		
    <attribute name="fill" type="string" />
    <attribute name="fill-opacity" type="string" />
    <attribute name="fill-rule" type="svg:fill-ruleType" />
    <attribute name="stroke" type="string" />
    <attribute name="stroke-dasharray" type="string" />
    <attribute name="stroke-dashoffset" type="string" />
    <attribute name="stroke-linecap" type="svg:stroke-linecapType" />
    <attribute name="stroke-linejoin" type="svg:stroke-linejoinType" />
    <attribute name="stroke-miterlimit" type="string" />
    <attribute name="stroke-opacity" type="string" />
    <attribute name="stroke-width" type="string" />
    
    <!-- Attributes for transformations -->
    
    <attribute name="transform" type="string" />
  	
 	</complexType>
  

  <!-- Elements for the ValueMapRenderer -->

  <element name="ValueMapRenderer">
    <complexType>
      	<choice minOccurs="0" maxOccurs="unbounded">
				<element ref="axl:Exact" />
				<element ref="axl:Range" />
				<element ref="axl:Other" />
      	</choice>
      
      <!-- featureProperty (instead of the original attribute lookupfield):
      		references the property (attribute) of a feature type
      -->
      
      <attribute name="featureProperty" type="string" use="required" />
    </complexType>
  </element>
  
  <element name="Exact">
    <complexType>
      	<choice maxOccurs="unbounded">
	  		<element ref="axl:SimpleMarkerSymbol" />
	  		<element ref="axl:SimpleLineSymbol" />
	  		<element ref="axl:SimplePolygonSymbol" />
      	</choice>
      <attribute name="value" type="string" />
      <attribute name="method" default="isExact">
				<simpleType>
	  			<restriction base="string">
	    			<enumeration value="isExact" />
	    			<enumeration value="isContained" />
	  			</restriction>
				</simpleType>
      </attribute>
      <attribute name="label" type="string" />
    </complexType>
  </element>

  <element name="Range">
    <complexType>
      	<choice maxOccurs="unbounded">
	  		<element ref="axl:SimpleMarkerSymbol" />
	  		<element ref="axl:SimpleLineSymbol" />
	  		<element ref="axl:SimplePolygonSymbol" />
      	</choice>
      <attribute name="lower" type="string" use="required" />
      <attribute name="upper" type="string" use="required" />
      <attribute name="equality" default="lower">
				<simpleType>
	  			<restriction base="string">
	    			<enumeration value="all" />
	    			<enumeration value="upper" />
	    			<enumeration value="lower" />
	    			<enumeration value="none" />
	  			</restriction>
				</simpleType>
      </attribute>
      <attribute name="label" type="string" />
    </complexType>
  </element>

  <element name="Other">
    <complexType>
      	<choice>
	  		<element ref="axl:SimpleMarkerSymbol" />
	  		<element ref="axl:SimpleLineSymbol" />
	  		<element ref="axl:SimplePolygonSymbol" />
		</choice>
      <attribute name="label" type="string" />
    </complexType>
  </element>
</schema>

