c++ - Determine Xpath content via libxml -
i found following xml example not sure how xpath data can obtained in c++ (besides using boost ptree xmlparser).
/* evaluate xpath expression */ xpathobj = xmlxpathevalexpression(xpathexpr, xpathctx); if(xpathobj == null) { fprintf(stderr,"error: unable evaluate xpath expression \"%s\"\n", xpathexpr); xmlxpathfreecontext(xpathctx); xmlfreedoc(doc); return; } //cout <<"result : "<<xpathobj->stringval<<endl; /* fails bus error */
what contained in xpathobj depends on xpath expression matches. if you're looking text out of it, can iterate on nodes in xpathobj->nodesetval, calling xmlnodelistgetstring, show in example.
Comments
Post a Comment