Sometimes I find that GeoServer SLD files fail to validate, even when copying code directly from the SLD Cookbook.
For example, I start with the polygon with styled label sample code, paste it into a new GeoServer style, validate it, and confirm that everything is fine.
Next I try to add the label halo code:
<Halo>
<Radius>3</Radius>
<Fill>
<CssParameter name="fill">#FFFFFF</CssParameter>
</Fill>
</Halo>
I can see that the halo
is located just before the closing </TextSymbolizer>
in the SLD Cookbook example, so I paste it just before the </TextSymbolizer>
in my style:
<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
<Halo>
<Radius>3</Radius>
<Fill>
<CssParameter name="fill">#FFFFFF</CssParameter>
</Fill>
</Halo>
</TextSymbolizer>
This now fails to validate with the message:
line 41: cvc-complex-type.2.4.a: Invalid content was found starting with element 'Halo'. One of '{"http://www.opengis.net/sld":VendorOption}' is expected.
This error message doesn't really help me. What is the cause of this problem and how can it be rectified?