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>
When the following JavaScript object, with a custom namespace
xmlns:locusdefined in the root element and some nested element prefixed withlocus:, is serialized to a XML string withjsToString, the prefix gets removed in the browser:See demo
JS input
XML output
expected
actual