Re: [xml] Setting a context from a patricular node




Doesn't this sequence

     doc = xmlTextReaderCurrentDoc( reader);
     pathContext = xmlXPathNewContext( doc);

accomplish the same thing? Or are you suggesting that is is sufficient to
just set the xmlNodePtr
in the path context structure?

  --Eric "still learning about the libxml2 apis" W


James Dennett-3 wrote:

-----Original Message-----
From: xml-bounces gnome org [mailto:xml-bounces gnome org] On Behalf
Of
Abhishek Jain
Sent: Wednesday, November 07, 2007 3:22 PM
To: xml gnome org
Subject: [xml] Setting a context from a patricular node

Hi,

I want to set the xmlXPathContext from a particular node say
xmlNodePtr
node1 in a xmlDocPtr doc so that my XPath is evaluated in the subtree
of
node1.

Please let me know how can i do that.

While I'd be more comfortable if I could find this documented, so far as
I can tell the recommended approach is to set the "node" field of the
xmlXPathContext, i.e., context->node = node1; in your case.

I'd also note that some library calls will change the node, so you
should reset it before reusing a context.

-- James

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



-- 
View this message in context: 
http://www.nabble.com/Setting-a-context-from-a-patricular-node-tp13638367p14460172.html
Sent from the Gnome - Lib - Xml - General mailing list archive at Nabble.com.




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