Hi Daniel and everybody in the list,

First of all, thank you for your work on this powerful library !

I understand that, in order to perform a relative XPath search starting from a 
given XML node (that is, using an XPath string such as "element/@attr" to 
retrieve the attributes "attr" of the child nodes named "element" of a given 
tree node, be it "xmlNode") I have to do something like this:

xmlNodePtr xmlNode; // my 'context' node
const xmlChar* xpathExpr = BAD_CAST "element/@attr";

// Create xpath evaluation context
xmlXPathContextPtr xpathCtx = xmlXPathNewContext(xmlNode->doc);

// Set xpathCtx->node to the passed context node 
// before calling the XPath evaluation function,
// and use a relative search
xpathCtx->node = xmlNode;

// ... do the xpath work, etc. etc.

My application needs to be able to do that even if "xmlNode" does not belong to 
any DOM (that is, a subtree of nodes created by scratch). I tried to do this:

// Create xpath evaluation context
xpathCtx = xmlXPathNewContext(NULL);

and it seems to be working properly.
But I wonder, is that safe ? I tried with lots of different XPath strings on 
lots of different XML documents, but how can I tell my tests are exhaustive 
enough ?

Unfortunately my PMs do not allow me to switch to the latest version of 
libxml2. We started using version 2.6.14.

Thank you in advance for any help you can give me.

Massimiliano





____________________________________________________________
6X velocizzare la tua navigazione a 56k? 6X Web Accelerator di Libero!
Scaricalo su INTERNET GRATIS 6X http://www.libero.it


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

Reply via email to