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

<!-- *********************************************************************** -->
  <xsd:element name="StyledLayerDescriptor" type="sld:StyledLayerDescriptor"/>


  <xsd:element name="Name" type="xsd:string"/>
 <xsd:element name="PropertyName" type="xsd:string"/>
 <xsd:element name="FeatureTypeName" type="xsd:string"/>
 <xsd:element name="expression" type="xsd:string"/>
<xsd:element name="Filter" type="xsd:string"/>
<xsd:element name="Description" type="xsd:string"/>
<xsd:element name="InlineContent" type="xsd:string"/>
<xsd:element name="Symbol" type="xsd:string"/>

 
<xsd:element name="GraphicFill" type="xsd:string"/> 
<xsd:element name="Fill" type="xsd:string"/> 

  <xsd:simpleType name="VersionType">
    <xsd:annotation>
      <xsd:documentation>
        The "VersionType" merely restricts the version string that may
        be used with XML documents based on this schema.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="1.0.20"/>
    </xsd:restriction>
  </xsd:simpleType>


<!-- ****************************************** -->
    <xsd:complexType name="StyledLayerDescriptor">
      <xsd:sequence>
        <xsd:element ref="sld:Name" minOccurs="0"/>
        <xsd:element ref="sld:Description" minOccurs="0"/>
       
        <xsd:choice>
          <xsd:element ref="sld:NamedLayer" minOccurs="0" maxOccurs="unbounded"/>
          <xsd:element ref="sld:UserLayer" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:choice>
      </xsd:sequence>
      <xsd:attribute name="version" type="sld:VersionType" use="required"/>
    </xsd:complexType>
 

<!-- *********************************************************************** -->
  <xsd:annotation>
    <xsd:documentation>
      LAYERS AND STYLES
    </xsd:documentation>
  </xsd:annotation>

  <xsd:element name="NamedLayer">
    <xsd:annotation>
      <xsd:documentation>
        A NamedLayer is a layer of data that has a name advertised by a WMS.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="sld:Name"/>
        <xsd:element ref="sld:Description" minOccurs="0"/>
        <xsd:choice minOccurs="0" maxOccurs="unbounded">
          <xsd:element ref="sld:NamedStyle"/>
          <xsd:element ref="sld:UserStyle"/>
        </xsd:choice>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="NamedStyle">
    <xsd:annotation>
      <xsd:documentation>
        A NamedStyle is used to refer to a style that has a name in a WMS.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="sld:Name"/>
        <xsd:element ref="sld:Description" minOccurs="0"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="UserLayer">
    <xsd:annotation>
      <xsd:documentation>
        A UserLayer allows a user-defined layer to be built from WFS and
        WCS data.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="sld:Name" minOccurs="0"/>
        <xsd:element ref="sld:Description" minOccurs="0"/>
        <xsd:element ref="sld:UserStyle" maxOccurs="unbounded"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>


  <xsd:element name="UserStyle">
    <xsd:annotation>
      <xsd:documentation>
        A UserStyle allows user-defined styling and is semantically
        equivalent to a WMS named style.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="sld:Name" minOccurs="0"/>
        <xsd:element ref="sld:Description" minOccurs="0"/>
        <xsd:element ref="sld:IsDefault" minOccurs="0"/>
        <xsd:element ref="sld:FeatureStyle" maxOccurs="unbounded"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="IsDefault" type="xsd:boolean"/>


  <xsd:element name="FeatureStyle">
  <xsd:annotation>
    <xsd:documentation>
      A FeatureStyle contains styling information specific to one
      feature type.  This is the SLD level that separates the 'layer'
      handling from the 'feature' handling.
    </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:choice>
        <xsd:sequence>
          <xsd:element ref="sld:Name" minOccurs="0"/>
          <xsd:element ref="sld:Description" minOccurs="0"/>
         
          <xsd:element ref="sld:Rule" maxOccurs="unbounded"/>
        </xsd:sequence>
      </xsd:choice>
      <xsd:attribute name="version" type="sld:VersionType"/>
    </xsd:complexType>
  </xsd:element>
 
  <xsd:element name="Rule">
    <xsd:annotation>
      <xsd:documentation>
        A Rule is used to attach property/scale conditions to and group
        the individual symbols used for rendering.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="sld:Name" minOccurs="0"/>
        <xsd:element ref="sld:Description" minOccurs="0"/>
        <xsd:element ref="sld:LegendGraphic" minOccurs="0"/>
        <xsd:choice minOccurs="0">
         <!-- <xsd:element ref="ogc:Filter"/> -->
		<xsd:element ref="sld:Filter"/>
        </xsd:choice>
        <xsd:element ref="sld:Symbol" maxOccurs="unbounded"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="LegendGraphic">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="sld:Graphic"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
 

 <xsd:element name="Graphic">
    <xsd:annotation>
      <xsd:documentation>
        A "Graphic" specifies or refers to a "graphic symbol" with inherent
        shape, size, and coloring.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:choice minOccurs="0" maxOccurs="unbounded">
          <xsd:element ref="sld:Mark"/>
        </xsd:choice>
         </xsd:sequence>
    </xsd:complexType>
  </xsd:element>


  <xsd:element name="Mark">
    <xsd:annotation>
      <xsd:documentation>
        A "Mark" specifies a geometric shape and applies coloring to it.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="sld:Fill" minOccurs="0"/>
        <xsd:element ref="sld:Stroke" minOccurs="0"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

 <xsd:element name="Stroke">
    <xsd:annotation>
      <xsd:documentation>
        A "Stroke" specifies the appearance of a linear geometry.  It is
        defined in parallel with SVG strokes.  The following SvgParameters
        may be used: "stroke" (color), "stroke-opacity", "stroke-width",
        "stroke-linejoin", "stroke-linecap", "stroke-dasharray", and
        "stroke-dashoffset".  Others are not officially supported.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:choice minOccurs="0">
          <xsd:element ref="sld:GraphicFill"/>
          <xsd:element ref="sld:GraphicStroke"/>
        </xsd:choice>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>


<!-- !!!!!!!!!!!!!
 here is problem, when this element contain <xsd:element ref="sld:Graphic"/> ,
 so some cycle is created and -->

 <xsd:element name="GraphicStroke">
    <xsd:annotation>
      <xsd:documentation>
        A "GraphicStroke" defines a repated-linear graphic pattern to be used
        for stroking a line.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
       <xsd:element ref="sld:Graphic"/>  
	<!-- <xsd:element ref="sld:Name"/> -->
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>



</xsd:schema>
