Re: [xml] XPath on a subtree
- From: Daniel Veillard <veillard redhat com>
- To: Alex Bligh <alex alex org uk>
- Cc: xml gnome org
- Subject: Re: [xml] XPath on a subtree
- Date: Sat, 23 Mar 2013 22:23:36 +0800
On Sat, Mar 23, 2013 at 02:10:42PM +0000, Alex Bligh wrote:
On 23 Mar 2013, at 13:54, Daniel Veillard wrote:
I though I had added a macro but searched for it an no it's not there.
In the python bindings there is an extra function called
libxml2mod.xmlXPathSetContextNode()
That was what I was thinking of, but ...
xmlXPathObjectPtr
xmlXPathNodeEval(xmlNodePtr node, const xmlChar *str, xmlXPathContextPtr ctx)
as a simple wrapper around xmlXPathEval
... that would be equally useful.
Do you mind doing a patch ? :-)
actually it's good to set the doc too at that point before reusing
the context in the loop.
ctxt->doc = doc;
Isn't the doc set when you create the context? xmlXPathNewContext takes
a doc ptr.
yes but it's better to have the node and the doc in sync. Some XPath
evaluation may reset the doc (from libxslt, probably impossible in
practice from libxml2).
Daniel
--
Daniel Veillard | Open Source and Standards, Red Hat
veillard redhat com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | virtualization library http://libvirt.org/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]