List Info

Thread: Re: Question regarding XPath




Re: Question regarding XPath
country flaguser name
United States
2007-03-16 11:39:33
Daniel Veillard wrote:

> On Fri, Mar 16, 2007 at 09:03:01AM -0500, Ethan Metsger
wrote:

[snip]

> > shed some light on how xmlXPathEval differs from
xmlXPathEvalExpression,
> > and whether the issue is related to the context
passed?

This seems to be something of an FAQ around here.  It would
be useful
for the documentation of these functions to document how
they differ,
possibly with a reference to the XPath spec.  Maybe some
kind soul
reading this thread can find the time to prepare a patch.  I
don't have
time right now.
 
>   Use xmlXPathEval(), see XPath spec to see the real
difference:
>   http://www
.w3.org/TR/xpath#NT-LocationPath
>   [1]   	LocationPath
> 
>   http://www.w3.org/
TR/xpath#NT-Expr
>   [14]   	Expr

So the difference is that xmlXPathEvalExpression handles an
XPath
"Expr", whereas xmlXPathEval handles an XPath
"Location Path", which is
a particular kind of Expr.  In other words:
xmlXPathEvalExpression
should be able to handle any expression that xmlXPathEval
can, and a
number more.

(In http://mail.gnome.org/archives/xml/2001-July/msg00102.
html you
appeared to agree with Wai-Sun Chia that they are
functionally
identical.)

Is there a reason for advocating using the function that is
documented
as less powerful?  Certainly in the code I have that uses
libxml2, I
want to be able to evaluate any Expr, not only LocationPath
expressions.

-- James

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml

Re: Question regarding XPath
user name
2007-03-16 13:44:17
On Fri, Mar 16, 2007 at 09:39:33AM -0700, James Dennett
wrote:
> Daniel Veillard wrote:
> 
> > On Fri, Mar 16, 2007 at 09:03:01AM -0500, Ethan
Metsger wrote:
> 
> [snip]
> 
> > > shed some light on how xmlXPathEval differs
from
> xmlXPathEvalExpression,
> > > and whether the issue is related to the
context passed?
> 
> This seems to be something of an FAQ around here.  It
would be useful
> for the documentation of these functions to document
how they differ,
> possibly with a reference to the XPath spec.  Maybe
some kind soul
> reading this thread can find the time to prepare a
patch.  I don't have
> time right now.
>  
> >   Use xmlXPathEval(), see XPath spec to see the
real difference:
> >   http://www
.w3.org/TR/xpath#NT-LocationPath
> >   [1]   	LocationPath
> > 
> >   http://www.w3.org/
TR/xpath#NT-Expr
> >   [14]   	Expr
> 
> So the difference is that xmlXPathEvalExpression
handles an XPath
> "Expr", whereas xmlXPathEval handles an XPath
"Location Path", which is
> a particular kind of Expr.  In other words:
xmlXPathEvalExpression
> should be able to handle any expression that
xmlXPathEval can, and a
> number more.

  Actually no, they both call xmlXPathEvalExpr() and hence
both evaluate
based on production 14. As I said there should be no
perceived differences
between both call.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/v
irtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillardredhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ |
Rpmfind RPM search engine  http://rpmfind.net/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )