[Geoserver-users] Geoserver REST API modifies PUTted and POSTed styles

Hi there,

it turned out that Geoserver transparently modifies styles provided in
SLD format when these are PUTted or POSTed through the REST API.

Actually, we are using version 2.3.5 on Debian 6 64 Bit.

Remark: I did not find any way to get a JIRA account for filing this
bug, so I guess sending it to the mailing list is the recommended way.

In fact the styles are modified in a way, so that they are no longer
compatible or "visually equal" to the style that was loaded up through
the REST API.

It seems that both the PUT and POST operations for Styles (described at
http://docs.geoserver.org/stable/en/user/rest/api/styles.html) actually
parse and rewrite the provided SLDs with an XML parser, which is neither
documented nor appropriate (for my mind).

These are the most obvious modifications:

1. CDATA sections are removed.

This is the most annoying problem, which makes the REST API nearly
useless for styles, since CDATA sections are the recommended way for
including line breaks in labels and are also used for formatting legend
texts.

2. Several <ogc:Function name="strConcat"> function calls are inserted.

My original <Label>...</Label> block looked looks this:

<Label>
  <ogc:PropertyName>cbl___b</ogc:PropertyName><![CDATA[
]]>
  <ogc:Function name="numberFormat">
    <ogc:Literal>#,###</ogc:Literal>
    <ogc:PropertyName>nakk__e</ogc:PropertyName>
  </ogc:Function>
</Label>

After loading up with the REST API, the block looks like this:

<sld:Label>
  <ogc:Function name="strConcat">
    <ogc:Function name="strConcat">
      <ogc:Function name="strConcat">
        <ogc:PropertyName>cbl___b</ogc:PropertyName>
        <ogc:Literal>
</ogc:Literal>
      </ogc:Function>
      <ogc:Literal> </ogc:Literal>
    </ogc:Function>
    <ogc:Function name="numberFormat">
      <ogc:Literal>#,###.0</ogc:Literal>
      <ogc:PropertyName>nakk__e</ogc:PropertyName>
    </ogc:Function>
  </ogc:Function>
</sld:Label>

For my mind, there is too much undocumented magic in this process.

3. The modified SLD uses explicit XML namespaces for all tags and
replaces the namespace declarations of the root element with (likely)
hardcoded declarations.

--

Regards

Carsten Klein

mail: c.klein@anonymised.com [mailto:c.klein@anonymised.com]

----------------------------------------------------------------------------
DataGis GmbH 2 & 3 dimensional
                Information Processing
                and Digital Cartography

Johann-Strauß-Str. 26 70794 Filderstadt
                              Germany

tel: +(49) 7158 940267
fax: +(49) 7158 940268
web: www.datagis.com
mail: info@anonymised.com

Management: Dr. Gunter Hahn, Markus Ruess, Carsten Klein
Entry in the commercial register of Germany: HRB 225945
at the local court of Stuttgart