I have defined the following SLD rule for my layer. It says that if the property Weekday is greater than or equal to 0 and less than or equal to 3, then the color of a polygon must be #680000.

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
  xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
      <Abstract>Direction and volume</Abstract>
          <Title>Volume control</Title>
          <Abstract>Volume control</Abstract>
              <CssParameter name="fill">#680000</CssParameter>

When I validate this rule in Geoserver 2.11, I get the following error:

line 15: cvc-complex-type.2.4.a: Invalid content was found starting with element 'Filter'. One of '{"http://www.opengis.net/sld":LegendGraphic, "http://www.opengis.net/ogc":Filter, "http://www.opengis.net/sld":ElseFilter, "http://www.opengis.net/sld":MinScaleDenominator, "http://www.opengis.net/sld":MaxScaleDenominator, "http://www.opengis.net/sld":Symbolizer}' is expected.

Line 15 is <Filter>. I checked the documentation of SLD and it looks like I defined all mandatory fields. Why do I get this error message and how can I solve this error?

1 Answer 1


You need to use the correct namespace for the filter element as the error message says.

Filter is in OGC name space so you need to use ogc: as a prefix and make sure you have declared it.

Your Answer

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

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