Search code examples
xml-libxml

Using xmlXPathDistinct in xmllib


I don't understand how to use xmlXPathDistinct for xmllib2

// xmlNodeSetPtr    xmlXPathDistinct    (xmlNodeSetPtr nodes)


xmlXPathObjectPtr result;
...
if(result) {       
    xmlNodeSetPtr nodeset = xmlXPathDistinct(result->nodesetval);

    --> warning: initialization makes pointer from integer without a cast

Could someone provide me an example?

Riccardo

edit: gcc -o test2 test2.c -L/usr/local/lib xml2-config --cflags --libs -lpthread -m64

Linux mymachine 2.6.32-358.23.2.el6.x86_64 #1 SMP Wed Oct 16 18:37:12 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux


Solution

  • Ok, found. All these headers must be included

     #include <libxml/xmlmemory.h>
     #include <libxml/parser.h>
     #include <libxml/tree.h>
     #include <libxml/valid.h>
     #include <libxml/hash.h>
     #include <libxml/xmlerror.h>
     #include <libxml/xpath.h>
     #include <libxml/xpathInternals.h>
     #include <libxml/parserInternals.h>
     #include <libxml/uri.h>
     #include <libxml/xpointer.h>