node-js2xmlparser
node-js2xmlparser copied to clipboard
when use '#', the text will have \n
const js2xmlparser = require("js2xmlparser")
const obj = {
somefield: {
'#': some thing,
'otherfield': 'other thing'
}
};
js2xmlparser.parse("test", obj);
Produces the following xml:
<?xml version='1.0'?>
<test>
<somefield>
some thing
<otherfield> other thing</otherfield>
</somefield>
</test>
But I want the xml (when I watch the view-source):
<?xml version='1.0'?>
<test>
<somefield>some thing<otherfield> other thing</otherfield></somefield>
</test>
Anyone knows how to implement this?
find one way can fix it. add one param { format: { pretty: false } } e.g. js2xmlparser.parse('test', obj, { format: { pretty: false } });