Re: [xml] Re: Apparent XPath bug in libxml 2.2.7

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Mon Nov 13 2000 - 09:48:46 EST


On Mon, Nov 13, 2000 at 02:37:13PM +0100, TOM wrote:
> Wouldn't it be better to add a function for setting a node as the
> context node, as it is done for the root node in xmlXPathRoot ?
>
> Something like this :
> /**
> * xmlXPathSetContextNode:
> * @ctxt: the XPath Parser context
> * @node: the new context node
> *
> * Initialize the context to @node
> */
> void
> xmlXPathSetContextNode(xmlXPathParserContextPtr ctxt,
> xmlNodePtr node) {
> ctxt->context->node = node;
> valuePush(ctxt, xmlXPathNewNodeSet(node));
> }

  I don't think it is really useful:
    - xmlXPathParserContextPtr are more internal structures
    - changing this for an xmlXPathContextPtr would make more sense
    - there is a problem of detecting extra element left on the
      evaluation stack: if you evaluate "2" the nodeset added should
      not generate an error. If another nodeset is found left on the
      stack at the end we should raise the problem
      => the initialization and checking really belongs to xmlXPathEval()
         not to a user level routine.

Daniel

-- 
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | libxml Gnome XML toolkit
Tel : +33 476 615 257  | 655, avenue de l'Europe | http://xmlsoft.org/
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | Rpmfind search site
 http://www.w3.org/People/all#veillard%40w3.org  | http://rpmfind.net/
----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Mon Nov 13 2000 - 10:47:24 EST