jxon
jxon copied to clipboard
Namespace prefix removed with jsToString in browsers
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:
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>