[Geoserver-users] QGIS symbology categorized - code not working in Geoserver Style Editor?

I customized symbology of a shapefile in QGIS and saved it as SLD file. I
want to create a style in the Style Editor using this SLD file but I get the
following error when I validate it:

line 108: cvc-complex-type.2.4.a: Invalid content was found starting with
element 'ogc:Filter'. One of '{"http://www.opengis.net/ogc":expression\}' is
expected.
line 109: cvc-complex-type.2.4.a: Invalid content was found starting with
element 'ogc:Literal'. One of '{"http://www.opengis.net/ogc":spatialOps,
"http://www.opengis.net/ogc":comparisonOps,
"http://www.opengis.net/ogc":logicOps, "http://www.opengis.net/ogc":\_Id\}' is
expected.

I categorized the shapefile symbology based on a field in the attribute
table (NAME_1). I am not sure if this has anything to do with it. Here is
the code:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; version="1.1.0"
xmlns:xlink="http://www.w3.org/1999/xlink&quot;
xsi:schemaLocation="http://www.opengis.net/sld
http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd&quot;
xmlns:se="http://www.opengis.net/se&quot;&gt;
  <NamedLayer>
    <se:Name>Great_Britain</se:Name>
    <UserStyle>
      <se:Name>Great_Britain</se:Name>
      <se:FeatureTypeStyle>
        <se:Rule>
          <se:Name>England</se:Name>
          <se:Description>
            <se:Title>England</se:Title>
          </se:Description>
          <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>NAME_1</ogc:PropertyName>
              <ogc:Literal>England</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <se:PolygonSymbolizer>
            <se:Fill>
              <se:SvgParameter name="fill">#fb9a99</se:SvgParameter>
            </se:Fill>
            <se:Stroke>
              <se:SvgParameter name="stroke">#ca7c7c</se:SvgParameter>
              <se:SvgParameter name="stroke-width">0.26</se:SvgParameter>
              <se:SvgParameter
name="stroke-linejoin">bevel</se:SvgParameter>
            </se:Stroke>
          </se:PolygonSymbolizer>
        </se:Rule>
        <se:Rule>
          <se:Name>Northern Ireland</se:Name>
          <se:Description>
            <se:Title>Northern Ireland</se:Title>
          </se:Description>
          <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>NAME_1</ogc:PropertyName>
              <ogc:Literal>Northern Ireland</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <se:PolygonSymbolizer>
            <se:Fill>
              <se:SvgParameter name="fill">#ee83ee</se:SvgParameter>
            </se:Fill>
            <se:Stroke>
              <se:SvgParameter name="stroke">#a04ba0</se:SvgParameter>
              <se:SvgParameter name="stroke-width">0.26</se:SvgParameter>
              <se:SvgParameter
name="stroke-linejoin">bevel</se:SvgParameter>
            </se:Stroke>
          </se:PolygonSymbolizer>
        </se:Rule>
        <se:Rule>
          <se:Name>Scotland</se:Name>
          <se:Description>
            <se:Title>Scotland</se:Title>
          </se:Description>
          <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>NAME_1</ogc:PropertyName>
              <ogc:Literal>Scotland</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <se:PolygonSymbolizer>
            <se:Fill>
              <se:SvgParameter name="fill">#badd69</se:SvgParameter>
            </se:Fill>
            <se:Stroke>
              <se:SvgParameter name="stroke">#809848</se:SvgParameter>
              <se:SvgParameter name="stroke-width">0.26</se:SvgParameter>
              <se:SvgParameter
name="stroke-linejoin">bevel</se:SvgParameter>
            </se:Stroke>
          </se:PolygonSymbolizer>
        </se:Rule>
        <se:Rule>
          <se:Name>Wales</se:Name>
          <se:Description>
            <se:Title>Wales</se:Title>
          </se:Description>
          <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>NAME_1</ogc:PropertyName>
              <ogc:Literal>Wales</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <se:PolygonSymbolizer>
            <se:Fill>
              <se:SvgParameter name="fill">#a5bfdd</se:SvgParameter>
            </se:Fill>
            <se:Stroke>
              <se:SvgParameter name="stroke">#728584</se:SvgParameter>
              <se:SvgParameter name="stroke-width">0.26</se:SvgParameter>
              <se:SvgParameter
name="stroke-linejoin">bevel</se:SvgParameter>
            </se:Stroke>
          </se:PolygonSymbolizer>
          <se:PolygonSymbolizer>
            <se:Fill>
              <se:GraphicFill>
                <se:Graphic>
                  <se:Mark>
                    <se:WellKnownName>horline</se:WellKnownName>
                    <se:Stroke>
                      <se:SvgParameter
name="stroke">#000000</se:SvgParameter>
                      <se:SvgParameter
name="stroke-width">0.26</se:SvgParameter>
                    </se:Stroke>
                  </se:Mark>
                  <se:Size>2</se:Size>
                  <se:Rotation>
                    <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
                      <ogc:Literal>45</ogc:Literal>
                    </ogc:Filter>
                  </se:Rotation>
                  <se:Displacement>
                    <se:DisplacementX>0.850904</se:DisplacementX>
                    <se:DisplacementY>0.525322</se:DisplacementY>
                  </se:Displacement>
                </se:Graphic>
              </se:GraphicFill>
            </se:Fill>
          </se:PolygonSymbolizer>
        </se:Rule>
        <se:Rule>
          <se:Name></se:Name>
          <se:Description>
            <se:Title>NAME_1 is ''</se:Title>
          </se:Description>
          <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>NAME_1</ogc:PropertyName>
              <ogc:Literal></ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <se:PolygonSymbolizer>
            <se:Fill>
              <se:SvgParameter name="fill">#c1d66d</se:SvgParameter>
            </se:Fill>
            <se:Stroke>
              <se:SvgParameter name="stroke">#000000</se:SvgParameter>
              <se:SvgParameter name="stroke-width">0.26</se:SvgParameter>
              <se:SvgParameter
name="stroke-linejoin">bevel</se:SvgParameter>
            </se:Stroke>
          </se:PolygonSymbolizer>
        </se:Rule>
      </se:FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/QGIS-symbology-categorized-code-not-working-in-Geoserver-Style-Editor-tp5242986.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

This part of your SLD is schema-invalid because the content model of se:Rotation is a sequence of ogc:expression and ogc:Filter cannot appear here:

<se:Rotation>
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
<ogc:Literal>45</ogc:Literal>
</ogc:Filter>
</se:Rotation>

Did you mean this?

<se:Rotation>
<ogc:Literal>45</ogc:Literal>
</se:Rotation>

Also, your use of xmlns:ogc on on-root elements throughout unnecessary because this namespace prefix is declared with the same value in the root element.

Kind regards,
Ben.

On 27/12/15 11:45, epyks23 wrote:

I customized symbology of a shapefile in QGIS and saved it as SLD file. I
want to create a style in the Style Editor using this SLD file but I get the
following error when I validate it:

line 108: cvc-complex-type.2.4.a: Invalid content was found starting with
element 'ogc:Filter'. One of '{"http://www.opengis.net/ogc&quot;:expression\}' is
expected.
line 109: cvc-complex-type.2.4.a: Invalid content was found starting with
element 'ogc:Literal'. One of '{"http://www.opengis.net/ogc&quot;:spatialOps,
"http://www.opengis.net/ogc&quot;:comparisonOps,
"http://www.opengis.net/ogc&quot;:logicOps, "http://www.opengis.net/ogc&quot;:\_Id\}' is
expected.

I categorized the shapefile symbology based on a field in the attribute
table (NAME_1). I am not sure if this has anything to do with it. Here is
the code:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; version="1.1.0"
xmlns:xlink="http://www.w3.org/1999/xlink&quot;
xsi:schemaLocation="http://www.opengis.net/sld
http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd&quot;
xmlns:se="http://www.opengis.net/se&quot;&gt;
   <NamedLayer>
     <se:Name>Great_Britain</se:Name>
     <UserStyle>
       <se:Name>Great_Britain</se:Name>
       <se:FeatureTypeStyle>
         <se:Rule>
           <se:Name>England</se:Name>
           <se:Description>
             <se:Title>England</se:Title>
           </se:Description>
           <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
             <ogc:PropertyIsEqualTo>
               <ogc:PropertyName>NAME_1</ogc:PropertyName>
               <ogc:Literal>England</ogc:Literal>
             </ogc:PropertyIsEqualTo>
           </ogc:Filter>
           <se:PolygonSymbolizer>
             <se:Fill>
               <se:SvgParameter name="fill">#fb9a99</se:SvgParameter>
             </se:Fill>
             <se:Stroke>
               <se:SvgParameter name="stroke">#ca7c7c</se:SvgParameter>
               <se:SvgParameter name="stroke-width">0.26</se:SvgParameter>
               <se:SvgParameter
name="stroke-linejoin">bevel</se:SvgParameter>
             </se:Stroke>
           </se:PolygonSymbolizer>
         </se:Rule>
         <se:Rule>
           <se:Name>Northern Ireland</se:Name>
           <se:Description>
             <se:Title>Northern Ireland</se:Title>
           </se:Description>
           <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
             <ogc:PropertyIsEqualTo>
               <ogc:PropertyName>NAME_1</ogc:PropertyName>
               <ogc:Literal>Northern Ireland</ogc:Literal>
             </ogc:PropertyIsEqualTo>
           </ogc:Filter>
           <se:PolygonSymbolizer>
             <se:Fill>
               <se:SvgParameter name="fill">#ee83ee</se:SvgParameter>
             </se:Fill>
             <se:Stroke>
               <se:SvgParameter name="stroke">#a04ba0</se:SvgParameter>
               <se:SvgParameter name="stroke-width">0.26</se:SvgParameter>
               <se:SvgParameter
name="stroke-linejoin">bevel</se:SvgParameter>
             </se:Stroke>
           </se:PolygonSymbolizer>
         </se:Rule>
         <se:Rule>
           <se:Name>Scotland</se:Name>
           <se:Description>
             <se:Title>Scotland</se:Title>
           </se:Description>
           <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
             <ogc:PropertyIsEqualTo>
               <ogc:PropertyName>NAME_1</ogc:PropertyName>
               <ogc:Literal>Scotland</ogc:Literal>
             </ogc:PropertyIsEqualTo>
           </ogc:Filter>
           <se:PolygonSymbolizer>
             <se:Fill>
               <se:SvgParameter name="fill">#badd69</se:SvgParameter>
             </se:Fill>
             <se:Stroke>
               <se:SvgParameter name="stroke">#809848</se:SvgParameter>
               <se:SvgParameter name="stroke-width">0.26</se:SvgParameter>
               <se:SvgParameter
name="stroke-linejoin">bevel</se:SvgParameter>
             </se:Stroke>
           </se:PolygonSymbolizer>
         </se:Rule>
         <se:Rule>
           <se:Name>Wales</se:Name>
           <se:Description>
             <se:Title>Wales</se:Title>
           </se:Description>
           <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
             <ogc:PropertyIsEqualTo>
               <ogc:PropertyName>NAME_1</ogc:PropertyName>
               <ogc:Literal>Wales</ogc:Literal>
             </ogc:PropertyIsEqualTo>
           </ogc:Filter>
           <se:PolygonSymbolizer>
             <se:Fill>
               <se:SvgParameter name="fill">#a5bfdd</se:SvgParameter>
             </se:Fill>
             <se:Stroke>
               <se:SvgParameter name="stroke">#728584</se:SvgParameter>
               <se:SvgParameter name="stroke-width">0.26</se:SvgParameter>
               <se:SvgParameter
name="stroke-linejoin">bevel</se:SvgParameter>
             </se:Stroke>
           </se:PolygonSymbolizer>
           <se:PolygonSymbolizer>
             <se:Fill>
               <se:GraphicFill>
                 <se:Graphic>
                   <se:Mark>
                     <se:WellKnownName>horline</se:WellKnownName>
                     <se:Stroke>
                       <se:SvgParameter
name="stroke">#000000</se:SvgParameter>
                       <se:SvgParameter
name="stroke-width">0.26</se:SvgParameter>
                     </se:Stroke>
                   </se:Mark>
                   <se:Size>2</se:Size>
                   <se:Rotation>
                     <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
                       <ogc:Literal>45</ogc:Literal>
                     </ogc:Filter>
                   </se:Rotation>
                   <se:Displacement>
                     <se:DisplacementX>0.850904</se:DisplacementX>
                     <se:DisplacementY>0.525322</se:DisplacementY>
                   </se:Displacement>
                 </se:Graphic>
               </se:GraphicFill>
             </se:Fill>
           </se:PolygonSymbolizer>
         </se:Rule>
         <se:Rule>
           <se:Name></se:Name>
           <se:Description>
             <se:Title>NAME_1 is ''</se:Title>
           </se:Description>
           <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
             <ogc:PropertyIsEqualTo>
               <ogc:PropertyName>NAME_1</ogc:PropertyName>
               <ogc:Literal></ogc:Literal>
             </ogc:PropertyIsEqualTo>
           </ogc:Filter>
           <se:PolygonSymbolizer>
             <se:Fill>
               <se:SvgParameter name="fill">#c1d66d</se:SvgParameter>
             </se:Fill>
             <se:Stroke>
               <se:SvgParameter name="stroke">#000000</se:SvgParameter>
               <se:SvgParameter name="stroke-width">0.26</se:SvgParameter>
               <se:SvgParameter
name="stroke-linejoin">bevel</se:SvgParameter>
             </se:Stroke>
           </se:PolygonSymbolizer>
         </se:Rule>
       </se:FeatureTypeStyle>
     </UserStyle>
   </NamedLayer>
</StyledLayerDescriptor>

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/QGIS-symbology-categorized-code-not-working-in-Geoserver-Style-Editor-tp5242986.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Ben Caradoc-Davies <ben@anonymised.com>
Director
Transient Software Limited <http://transient.nz/&gt;
New Zealand

Thank you Ben Caradoc-Davies-2,
your suggestion helped and now it works!

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/QGIS-symbology-categorized-code-not-working-in-Geoserver-Style-Editor-tp5242986p5242992.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

The rotation element should only contain a literal not a filter - so delete the lines - <ogc:Filter xmlns:ogc=“http://www.opengis.net/ogc”> and </ogc:Filter> and all will be well. Please consider filing a QGis bug report about the issue too.

Cheers

Ian