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 fr开发者_JAVA百科om a xmlNodePtr
?
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.
It turns out you can cast xmlNodePtr
to xmlDocPtr
and visa-versa.
精彩评论