Hi All,I'm trying to use xmlAddChildList( ) and seems there is a strange problem in adding thischild list to the doctree (xmlDocPtr).here is the code snippet which creates the problem.bool AddChild(const string &path, xmlNodePtr node, AddChildType addType)
{
...............assume after evaluating the path, i have a xmlNodeSetPtr nodes;
xmlNodePtr pnode = nodes->nodeTab[0];switch (addType)
{
case eAddNode:
break;
case eAddNodeList:.............assume we have the xmlDocPtr tree;//xmlElemDump(stdout, tree, pnode); ----> this shows proper data of node.if (xmlAddChildList(pnode, node) == NULL) -----------> this adds the child list but the data is duplicated again for everycall of this function with a new nodelist
{
return false;
}
//xmlElemDump(stdout, tree, pnode); ----> this doesnt show proper data of pnode.
//xmlFreeNodeList(node);
break;
default:
break;
}
return true;
}for example, if I call this function with xmlNodePtr node has the data as,1st call : <childList1>......</childList1>2nd call: <childList2>......</childList2>3rd call: <childList3>......</childList3>now after this execution, the actual docTree has the info as follows,<childList1>......</childList1><childList2>......</childList2><childList1>......</childList1><childList3>......</childList3><childList1>......</childList1><childList2>......</childList2><childList1>......</childList1>but this should have added only once. Somehow the data gets duplicated afterxmlAddChildList( ). because the node contains the proper data. only the pnodeis having the wrong data.could you please help me on to figure out the problem or fix it.ThanksSenthil Nathan R