SLD- Cannot find the declaration of element StyledLayerDescriptor
Q: When having my SLD document validated, I keep getting this error:
1: <?xml version="1.0" encoding="UTF-8"?> 2: <StyledLayerDescriptor version="1.0.0" 3: xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" 4: xmlns="http://www.opengis.net/sld" 5: xmlns:ogc="http://www.opengis.net/ogc" 6: xmlns:xlink="http://www.w3.org/1999/xlink" 7: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> ---------------------------------------------------------^ cvc-elt.1: Cannot find the declaration of element 'StyledLayerDescriptor'. ---------------------------------------------^
Answer:
What this error is saying is that the validator cannot find the StyledLayerDescriptor.xsd document. To resolve this you need to change line 3 above to point to the location of your document:
3: xsi:schemaLocation="data/capabilities/StyledLayerDescriptor.xsd"
For versions of GeoServer 1.3.0-RC6 and below, the schema is included in data/capabilities/
For versions 1.3.0-RC7 and above, they have been moved to schemas/sld/
The relative path begins where your GeoServer was deployed, at the root of the deployment directory, usually (Geoserver/).