This feels like a pretty straightforward question, but for the life of me I can’t create an XML Object with CDATA.
I’ve been using:
XmlTree Scene("Scene", "");
XmlTree cdata("cdata", "");
cdata.setValue("This is a test.");
cdata.setNodeType(cinder::XmlTree::NodeType::NODE_CDATA);
Scene.push_back(cdata);
Scene.write(writeFile("ui.xml"));
And the XML tree returned is:
<?xml version="1.0" encoding="utf-8"?>
<Scene>
<![CDATA[
]]>
</Scene>
which clearly has empty CDATA.
I even tried entering the entire xml file as a string:
std::string xmlString = "<Scene><![CDATA[ " + "this is a test" + " ]]></Scene>";
XmlTree Scene(xmlString);
Scene.write(writeFile("ui.xml"));
But the XML this outputs lacks the CDATA entirely:
<?xml version="1.0" encoding="utf-8"?>
<Scene>this is a test</Scene>
How would I go about entering data into the CDATA field?