Re: [xml] create node from a string (with xml elements inside)
- From: Sylvain Pointeau <sylvain pointeau gmail com>
- To: xml gnome org
- Subject: Re: [xml] create node from a string (with xml elements inside)
- Date: Tue, 19 Apr 2011 17:40:12 +0200
Hello again,
I did it with parsing a doc in memory like
const char * xml = "<mycontent><mytext>hello</mytext></mycontent>";
xmlDocPtr doc_fragment = xmlReadMemory(xml, strlen(xml),"noname.xml",NULL,0);
xmlNodePtr root_node = xmlDocGetRootElement(doc_fragment);
xmlNodePtr new_node = xmlDocCopyNode (root_node, doc, 1);
xmlFreeDoc(doc_fragment);
xmlAddChild(mynodewhereIwanttoinsertthisfragment,new_node);
and it works!
is it the best solution? (only one?)
Best regards,
Sylvain
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]