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

Namespace prefix removed with jsToString in browsers #52

Open
nrenner opened this issue Mar 4, 2021 · 0 comments · May be fixed by #53
Open

Namespace prefix removed with jsToString in browsers #52

nrenner opened this issue Mar 4, 2021 · 0 comments · May be fixed by #53

Comments

@nrenner
Copy link

nrenner commented Mar 4, 2021

When the following JavaScript object, with a custom namespace xmlns:locus defined in the root element and some nested element prefixed with locus:, is serialized to a XML string with jsToString, the prefix gets removed in the browser:

See demo

JS input

{
    "gpx": {
        "$xmlns": "http://www.topografix.com/GPX/1/1",
        "$xmlns:locus": "http://www.locusmap.eu",
        "trk": {
            "extensions": {
                "locus:rteComputeType": "5"
            }
        }
    }
}

XML output

<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:locus="http://www.locusmap.eu">
  <trk>
    <extensions>
      <rteComputeType>5</rteComputeType>
    </extensions>
  </trk>
</gpx>

expected

      <locus:rteComputeType>5</locus:rteComputeType>

actual

      <rteComputeType>5</rteComputeType>
@nrenner nrenner linked a pull request Mar 4, 2021 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant