Re: xpath processing brain dead - Mailing list pgsql-hackers

From James Pye
Subject Re: xpath processing brain dead
Date
Msg-id 52E6D713-48A4-4EC0-8FF1-81B44C797CEF@jwp.name
Whole thread Raw
In response to Re: xpath processing brain dead  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: xpath processing brain dead  (James Pye <lists@jwp.name>)
List pgsql-hackers
On Feb 26, 2009, at 7:03 PM, Andrew Dunstan wrote:
> can you point me at any call in libxml2 which will evaluate an xpath  
> expression in the context of a nodeset instead of a document?

No, I can't. node-sets are XPath objects not xmlNode objects, so I  
don't think it would be as simple as modifying:

xml.c:xpath() {   ...   xpathctx->node = xmlDocGetRootElement(doc);

with the result of xmlXPathNewNodeSet..

[snip other questions]

My *guess* would be that if we were to use a node-set instead, we'd  
still have to prefix the XPath query. In this case, with a function  
call to an xpath extension function that creates the NodeSet from the  
content fragment(s?) of the document created by xml_parse(ie, more or  
less, a re-implementation of exsl:node-set() tailored for our use- 
case). Well, that or force the user to call it explicitly. Possible or  
not--wrt using a content fragment/document as the context node, I find  
this less desirable than the current mangling, so I'm becoming quite  
indifferent. :)


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: add_path optimization
Next
From: Tom Lane
Date:
Subject: Re: add_path optimization