tags:

views:

67

answers:

0

How can I copy the xmlNodeSet from from a xmlXPathObject?

This is my code now:

xmlNodeSet *get_nodes( xmlDoc *doc, xmlChar *xpath ) {
    xmlXPathContext *context;
    xmlXPathObject  *object;
    xmlNodeSet      *nodeSet;
    xmlXPathObject  *nObj;

    context = xmlXPathNewContext( doc );
    object = xmlXPathEvalExpression( xpath, context );

    xmlXPathFreeContext( context );

    /* Copy xmlNodeSet at object->nodesetval to a seperate xmlNodeSet */

    xmlXPathFreeObject( object );

    return nObj;
}