1

I generate the sld file from Qgis and upload it to the geoserver. My sld file looks like following,

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" version="1.0.0" xmlns:sld="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc">
  <UserLayer>
    <sld:LayerFeatureConstraints>
      <sld:FeatureTypeConstraint/>
    </sld:LayerFeatureConstraints>
    <sld:UserStyle>
      <sld:Name>PGA_100_reclass</sld:Name>
      <sld:FeatureTypeStyle>
        <sld:Rule>
          <sld:RasterSymbolizer>
            <sld:ChannelSelection>
              <sld:GrayChannel>
                <sld:SourceChannelName>1</sld:SourceChannelName>
              </sld:GrayChannel>
            </sld:ChannelSelection>
            <sld:ColorMap type="values">
              <sld:ColorMapEntry quantity="1" label="Low: PGA < 0.015, MMI < 5" color="#00b04f"/>
              <sld:ColorMapEntry quantity="2" label="Moderate: PGA 0.015 - 0.047, MMI 6 - 7" color="#ffbf00"/>
              <sld:ColorMapEntry quantity="3" label="High: PGA 0.047 - 0.149, MMI 8 - 9" color="#ff0000"/>
              <sld:ColorMapEntry quantity="4" label="Very high: PGA > 0.149, MMI > 10" color="#a80000"/>
            </sld:ColorMap>
          </sld:RasterSymbolizer>
        </sld:Rule>
      </sld:FeatureTypeStyle>
    </sld:UserStyle>
  </UserLayer>
</StyledLayerDescriptor>

The layer working fine until I updated my sld file. While I tried to validate this sld, it popup with following error,

org.xml.sax.SAXParseException; lineNumber: 18; columnNumber: 63; The value of attribute "label" associated with an element type "sld:ColorMapEntry" must not contain the '<' character.

I know this mean I can't use "<" and ">" sign in sld:ColorMapEntry. But is there any possible way to add these symbol in label?

3

The problem is the < and > can't appear inside an XML element as they are confused with starting and ending a tag. So, you must "encode" them as XML entities in this case < is &lt; and > is &gt;.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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