Re: [xml] best way copy of xmlXPathObjectPtr->node

Something like:

xmlNodeSetPtr doSomething(xmlDocPtr doc, const xmlChar* xpath) {
xmlNodeSetPtr ret = NULL;
xmlXPathObjectPtr obj;
obj = xmlXPathEval(xpath,ctxt);
if (obj != NULL && obj->type == XPATH_NODESET) {
  ret = obj->nodesetval;
  obj->nodesetval = NULL;
if (obj != NULL)
return ret;

                      oliverst online d                                                                       
                      e                        To:       xml gnome org                                        
                      Sent by:                 cc:                                                            
                      xml-admin gnome o        Subject:  [xml] best way copy of xmlXPathObjectPtr->node       
                      01/20/2004 07:40                                                                        


I wanted to do a function you give a xmlDocPtr and an XPath expression,
that returns a xmlNodeSetPtr, so you don't have to create any
xmlXPathContextPtr. The problem is, that nodesetval is being free'd,
when I call xmlXPathFreeObject() and I haven't found a function in
libxml2 to copy a xmlNodeSetPtr. Is there a better way to get a copy
beside loop through all the nodes and put them in a new xmlNodeSetPtr

xml mailing list, project page
xml gnome org

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