javascript - Issue while converting from JSON to XML -
when converting below json xml, seems __text property being stripped off xml.
{ "root": { "number": { "__text": "1\n-\n222\n-\n500" } } } can tell how __text property changes , __text represents?
below fiddle , library used
the __text property changes javascript syntax of multi-line string xml syntax of multi-line string. means \n converted newline.
1\n-\n222\n-\n500
will become
1 - 222 - 500 which same, in different notation
without knowing library you're using, i'd guess __text represents content of property you're describing.
looking source of library seems _ indicates attribute , attribute __text special attribute indicate text contained inside xml element when element has attributes.
here updated fiddle should understand better: https://jsfiddle.net/gtlbx/924/
here source code snippets, imply things assumed:
_attribute, because of line 31:config.attributeprefix = config.attributeprefix || "_";
_textname of internal attribute, because of this line 272:result.__text = result.__text.join("\n");
Comments
Post a Comment