Re: [xml] XPath context

On Fri, Apr 20, 2001 at 01:12:27PM -0400, carl douglas convergys com wrote:

Would someone mind explaining to me what effect setting
the node member in a xmlXPathContext structure has on
an X Path evaluation.

for example,

ctxt = xmlXPathNewContextPtr(doc);
ctxt->node = xmlDocGetRootElement(doc);

result = xmlXPathEval( BAD_CAST"/book/chapter[1]/descendant::*", ctxt");

  won't change anything for this XPath expression but is very
important when you do a relative path query like:


 if you're placed at the root would will have a different answer as
if placed at /book

  You can play with relative and absolut XPath queries when using
xmllint --shell yourfile

  the cd/ls/etc... commands uses a XPath expressions to locate their
target nodes.


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml Gnome XML XSLT toolkit | Rpmfind RPM search engine

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