Re: [libxml++] Add CdataNode to DOM tree



Talking to myself, but maybe somebody wants to do the same thing. Anyway, after studying the libxml++ sources I noticed that you can add any node through the underlying c-object like this:

string content = "some content";
_xmlNode * cnode = cppnode>cobj();
xmlNodePtr cdata = xmlNewCDataBlock(cppdoc->cobj(), (const xmlChar*) content.c_str(), content.size());
xmlAddChild(cnode, cdata);

The c++ wrapper registers a callback in the c-lib that is called when a node is added to the c-doc, creates a c++ object for the c-node and adds it to the c++-doc. Something like that at least...

Greets,
Andrej



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]