Is there a way to dynamically add CDATA that conforms to type:"cdata"?
var xml = "<container> <tag1> <![CDATA[ asdf ]]> </tag1> <tag2/> </container>";
var $ = require("cheerio").load(xml, {xmlMode:true});
$("tag2").append("<![CDATA[ asdf ]]>");
$(":root").append("<tag3><![CDATA[ asdf ]]></tag3>").children("tag3");
// <container> <tag1> <![CDATA[ asdf ]]> </tag1> <tag2><!--[CDATA[ asdf ]]--></tag2> <tag3><!--[CDATA[ asdf ]]--></tag3></container>
console.log( $.xml() );
So far, all I could figure out was to manually mimic the object/array structure (annoying).
Is there a way to dynamically add CDATA that conforms to
type:"cdata"?So far, all I could figure out was to manually mimic the object/array structure (annoying).