Skip to content

Commit

Permalink
xml2json update for function
Browse files Browse the repository at this point in the history
reference to pull request reference request tonytomov#598 for original
  • Loading branch information
kccarter76 committed May 13, 2014
1 parent 9476f35 commit 9f0b324
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions js/JsonXml.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,22 @@ var xmlJsonClass = {
o["#text"] = this.escape(this.innerXml(xml));
}
}
}
else if (textChild) {
} else if (textChild) {
// pure text
if (!xml.attributes.length) {
o = this.escape(this.innerXml(xml));
if (o === "__EMPTY_ARRAY_") {
o = "[]";
} else if (o === "__EMPTY_STRING_") {
o = "";
}
}
else {
o = this.innerXml(xml);
if (o === "__EMPTY_ARRAY_") {
o = "[]";
} else if (o === "__EMPTY_STRING_") {
o = "";
} else if (/^function/.test(o)) {
o = $.parseJSON('{fn:' + $.jgrid.htmlDecode(o) + '}').fn;
} else if (/^(true|false)/.test(o)) {
o = o === 'true';
} else {
o = this.escape(o);
}
} else {
o["#text"] = this.escape(this.innerXml(xml));
}
}
Expand Down Expand Up @@ -336,4 +340,4 @@ var xmlJsonClass = {
}
return e;
}
};
};

0 comments on commit 9f0b324

Please sign in to comment.