In NodeJS by using xml2js module I am converting the XML string to JSON object and after some edit again converting that JSON object back into XML. All this is working well however the problem is that CDATA tags are missing in the converted XML. Can someone help me with this? I am giving the sample code below which has the same issue.
var xml2js = require('xml2js');
var parser = new xml2js.Parser();
parser.parseString("<myxml myattribute='value'><![CDATA[Hello again]]>
</myxml>", function (err, data) {
var builder = new xml2js.Builder({
cdata: true
});
var xml = builder.buildObject(data);
console.log(" ------------ "+xml);
});
Thanks -kt
via KT B
No comments:
Post a Comment