I'm using angularjs to develop my application. I use a JSON variable which I want to convert into xml. I do it with the following code :
My JSON variable :
variableJSON = {
"content": {
"section": []
},
"field": {
"string": [],
"integer": [],
"decimal": [],
"list": [],
"iterator": []
},
};
I fill it when my application run.
And this is my code to convert it :
x2js = new X2JS({
escapeMode: false,
});
var xmlVar = $scope.x2js.json2xml_str(variableJSON);
This is an adaptation. My real code isn't like this so it's possible it's not working with the code here.
Finally I have this :
<content><section id='S0'><label lang='en'>Section 1</label><single name='Q0'><label lang='en'>Question 1</label></single></section></content><field></field>
As you can see, there is only one line. I would like to skip line for each different tags to have a proper view of what I generated. But I don't want to do it after the generation. When the XML is generated I must keep it intact. I couldn't find a solution on x2js website or on any forum.
Do you have a solution to skip line during the XML generation ?
Thank you in advance.