seetsy / x2js

Automatically exported from code.google.com/p/x2js
0 stars 0 forks source link

Arrays not handled correctly #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Run these two lines in your JavaScript console:
1. var xmlStr = "<xml><title name='MODE'>show</title><title 
name='VAR'>me</title></xml>"
2. X2JS.json2xml_str(X2JS.xml_str2json(xmlStr))

What is the expected output? What do you see instead?
Expected output: "<xml><title name='MODE'>show</title><title 
name='VAR'>me</title></xml>"
Actual output: "<xml><title></title><title></title></xml>"

What version of the product are you using? On what operating system?
Using version 1.0.7 in Chrome

Please provide any additional information below.
I fixed this by making a 5 line change to version 1.0.6**. My file is attached.

The for loop at line 196 now is:

for(var arIdx = 0; arIdx < subObj.length; arIdx++) {
    if(arrayOfObjects){
        var arrObj = {};
    arrObj[it] = subObj[arIdx];
    result+=parseJSONObject(arrObj);
    } else {
         ...
    }}

** Link to version 1.0.6: 
http://code.google.com/p/x2js/source/browse/xml2json.js?spec=svn8326889cdfbe9512
26417adbed94952ef9d7a06f&r=ee0824ba76a41fe7be65546e145ccd591f9dc662

Original issue reported on code.google.com by paulmed...@gmail.com on 15 Oct 2012 at 2:55

Attachments:

GoogleCodeExporter commented 9 years ago
Working on it
Thank you for submit issue!

Original comment by abdulla....@gmail.com on 18 Oct 2012 at 5:49

GoogleCodeExporter commented 9 years ago
Fixed in 1.0.8.
Thank you!

Original comment by abdulla....@gmail.com on 18 Oct 2012 at 8:58