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.

http://www.xmlsoft.org/tutorial/ar01s05.html


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -