position of $t property is matter for XML generation
iuriifavi opened this issue · 2 comments
iuriifavi commented
xml2json.toXml({ShippingServiceAdditionalCost: { '$t': 0, currencyID: 'USD' } }})
==
"<ShippingServiceAdditionalCost>0 currencyID="USD"</ShippingServiceAdditionalCost>"
and
xml2json.toXml({ShippingServiceAdditionalCost: { currencyID: 'USD', '$t': 0 } }})
==
"<ShippingServiceAdditionalCost currencyID="USD">0</ShippingServiceAdditionalCost>"
c4milo commented
hmm, interesting. It looks like a bug indeed.
iuriifavi commented
ToXml.prototype.parse = function(obj) {
var self = this;
var keys = Object.keys(obj);
var len = keys.length;
// Sub node should be moved to the end
keys.sort(_ => _ == '$t');