Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLD Parser does not support element order #246

Closed
hwbllmnn opened this issue Jun 27, 2019 · 2 comments
Closed

SLD Parser does not support element order #246

hwbllmnn opened this issue Jun 27, 2019 · 2 comments

Comments

@hwbllmnn
Copy link
Contributor

PARSER

SLD

BUG

Description:

The SLD parser (or specifically the underlying xml2js library) does not properly support element order. For reading this could work if we'd use the appropriate xml2js options, but for writing these are not supported. This means that writing out a style like this may rearrange elements. Example:

{
  "name": "Demo Style",
  "rules": [
    {
      "name": "Rule 1",
      "symbolizers": [
        {
          "kind": "Text",
          "label": "Your Label{{value}}My label{{name}}{{other}}Something",
          "size": 12
        }
      ]
    }
  ]
}

Paste this in the demo, switch to SLD, copy the SLD, reload and paste the SLD back in and you'll get:

{
  "name": "Demo Style",
  "rules": [
    {
      "name": "Rule 1",
      "symbolizers": [
        {
          "kind": "Text",
          "label": "Your Label{{value}}My label{{name}}Something{{other}}",
          "size": 12
        }
      ]
    }
  ]
}

This is currently the only place I can think of where it might cause problems, but once we'll support functions which get a list of parameters this will cause problems.

It's also not very nice on the filter level because filters of the same type on the same level will always be grouped together, regardless of the original definition.

IMHO we should switch to a different way of XML generation.

@glenselle
Copy link

I was looking at libraries to parse XML before I stumbled on the geostyler suite of libs. I'm not sure if fast-xml-parser solves the problem here in the issue, but it does seem to be much more performant than xml2js. Just throwing it out there

@jansule jansule transferred this issue from geostyler/geostyler Sep 30, 2019
@KaiVolland
Copy link
Contributor

Solved with #682

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants