Re: [xml] create node from a string (with xml elements inside)




 I would rather suggest you use xmlParseInNodeContext() for this,
see include/libxml/parser.h
  http://xmlsoft.org/html/libxml-parser.html#xmlParseInNodeContext

 You will get back a node list to place at that location, it doesn't
try to insert automatically.


I followed your recommendation and I did:

        xmlNodePtr new_nodes = NULL;
        xmlParserErrors error = xmlParseInNodeContext	(curr_node, xml.c_str(), xml.size(), 0, &new_nodes);

        assert(error==XML_ERR_OK);

        xmlAddChildList(curr_node,new_nodes);
 
libxml2 is really great, I really enjoy to use it.

Many thanks,
Sylvain


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