[xml] how to use ::xmlXPathCompile



Hi,
I have a problem of using the function ::xmlXPathCompile in Fedora Core 6
The code  to use this function is as follows:
        ::xmlInitParser();
        ::xmlXPathCompExpr* expr = ::xmlXPathCompile(from_string(argv[1]));
        if(expr == NULL)
                printf("Error while parsing XPath _expression_\n");

        printf("XPE: %s\n", argv[1]);
        printf("nbStep=%d, maxStep=%d, last=%d\n", expr->nbStep, expr->maxStep,expr->last);
        printf("expr is %s\n", expr->expr);

i passed the parameter "/nitf/head" to the function, but the return is as follows :
XPE: /nitf/head
nbStep = 0, maxStep = 10, last = -1
expr is (null)

The file main.cpp is compile as follows :
g++ -c  -D_REENTRANT -fPIC -I. -I/usr/include/libxml2 -c -w -O  -DAPP_NO_THREADS -DXML_USE_NO_THREADS  -o /home/niyuan/TestXPathParser/bin/obj/main.o /home/niyuan/TestXPathParser/src/main.cpp
g++ -D -fPIC -L/usr/lib    /home/niyuan/TestXPathParser/bin/obj/main.o  -o /home/niyuan/TestXPathParser/bin/TestXPathParser -L/usr/lib -lxml2  -lc -lstdc++ -lnsl

so what is the problem here?
Thank you very much for the help!

Regards,
Ni Yuan
 




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