Reputation: 11305
I've looked through the docs and it seems that you can only execute an xpath search from a xmlDocPtr
by creating an xpath context. Is there anyway in libxml2 to xpath search from a xmlNodePtr
?
Upvotes: 0
Views: 3461
Reputation: 597081
Call xmlXPathNewContext
(), specifying the real top-level xmlDocPtr
for the document, then set the xmlXPathContext::node
field to the desired xmlNodePtr
pointer that is a child of the xmlDocPtr
document.
Upvotes: 1
Reputation: 11305
It turns out you can cast xmlNodePtr
to xmlDocPtr
and visa-versa.
Upvotes: 0