I rendert a beautiful with QGIS based on OSM data. Now I want to publish it via GeoServer. I am new to GeoServer but as far as I it does not accept SLD files created by QGIS.

My GeoServer cannot validate my code.

Does someone has a clue how to change the style so that GeoServer recognizes it?

The SLD content is:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" xmlns:se="http://www.opengis.net/se">
      <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
          <se:SvgParameter name="stroke">#e4e4e4</se:SvgParameter>
          <se:SvgParameter name="stroke-width">0.26</se:SvgParameter>
          <se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>
          <se:SvgParameter name="stroke-linecap">square</se:SvgParameter>
                  <se:SvgParameter name="fill">#e4e4e4</se:SvgParameter>
                  <se:SvgParameter name="stroke">#e4e4e4</se:SvgParameter>
              <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">

  • possible duplicate of Issues with datasets when custom SLD loaded into geoserver
    – user30184
    Sep 13, 2014 at 12:47
  • I've read that before and tried to do the changes. But without success. Therefore I posted this question.
    – hoge6b01
    Sep 13, 2014 at 13:34
  • I would perhaps create a style that reminds your QGIS style with uDig and compare the two SLDs.
    – user30184
    Sep 13, 2014 at 14:31
  • thanks. But that's what I want to avoid. I've got lots of layers with that problem. Anybody knows if this will be integrated in future versions of GeoServer?
    – hoge6b01
    Sep 13, 2014 at 16:45
  • 1
    could you mention what the error is?
    – Ian Turton
    Sep 13, 2014 at 19:53

2 Answers 2


OK - I pasted the SLD you supplied in to GeoServer - first it helpfully points out that you are missing the closing tags for


at the end.

Once the XML is complete it complains about

line 46: 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 47: 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.

So there is a problem at line 46 - it seems that it was expecting an expression (Literal, PropertyName etc) in the se:Gap element and you have a Filter (which is badly formed). If you delete the Filter and the /Filter elements everything validates.

However you will notice that the style is not showing up in the preview - this is because line is not a Well Known Name for a mark (see this list) so replacing it with shape://vertline fixes all your issues.

This looks like the SLD is invalid as generated so you may want to file a bug report with the QGIS folks.


Here´s what worked out for me: Basically it´s just 3 steps, using the "search and replace" tool:

1- i replaced the first line with one from an existing geoserver sld:

2- Also copy the first lines raplacing the "****" with your own

         <sld:Name>****** </sld:Name>

and do the same with the closings


3- Use the search and replace tool: replace <se: and </se: with <sld: and </sld: respectivly. And replace SvgParameter with CssParameter

Sorry if i don´t use correct vocabulary, i´m not so much into coding, neather into english language. Please someone improve my answer.

A co-worker made a script to do the steps before automatically with RStudio and made it even simpler for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.