[xml] libxml2 and xpath use



hi there,

I'm using the xpath API from libxml2 to locate nodes in a document.
Specifically, I'm using

  xmlXPathContextPtr ctxt = xmlXPathNewContext(mImpl->xmldoc);
  xmlXPathObjectPtr res = xmlXPathEvalExpression(BAD_CAST xpath, ctxt);

what is the correct way to search starting not on the document's
root node, but some child node ? Should I set the node in the xmldoc
structure manually before creating the path context ?

Second, libxml2 writes out an error message whenever the path expression
is incorrect. Is there a way to suppress this output ? Or better yet,
can I obtain the error programmatically to deal with it on a higher
level (error return values or something like errno...).

Best regards,
                Stefan






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