Skip to content

Namespace prefix removed with jsToString in browsers #52

@nrenner

Description

@nrenner

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions