First of all thank you for the quick response ^___^

I understand the point in your answer and I'm fine with it.
I'm currently forced to use this trick because my previous solution (1.creating 
a new temporary document, 2.setting the context node as its root node, 
3.performing the relative Xpath search in the "proper" way, 4.detach the 
context node from its temporary document) gave me some weird problems in some 
circumstances (nodes "disappearing" ^__^) even if I forced the subtree to point 
to the temporary document, and then removed this pointing, using the 
xmlSetTreeDoc API on the context node.

There's just one more doubt that I have:
By saying "none of the XPath expressions need to access the root" you're 
referring to the explicit usage, within the XPath string, of axis like 
'ancestor', 'ancestor-or-self', 'namespace', 'parent' ?

Thank you again, bye
Massimiliano


---------- Initial Header -----------

>From      : "Daniel Veillard" [EMAIL PROTECTED]
To          : "[EMAIL PROTECTED]" [EMAIL PROTECTED]
Cc          : "xml" [email protected]
Date      : Wed, 13 Jul 2005 04:59:18 -0400
Subject : Re: [xml] Relative XPath search

> On Wed, Jul 13, 2005 at 10:31:08AM +0200, [EMAIL PROTECTED] wrote:
> > 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 ?
>
>   This should be safe as long as none of the XPath expressions need to
> access the root, but this is a non-common situation so you are exposing
> yourself to potential bugs that may have been unnoticed because everybody
> tests with document where all nodes refers to a doc.
>   I can't give a formal "this is safe" statement.
>
> Daniel
>
> --
> Daniel Veillard      | Red Hat Desktop team http://redhat.com/
> [EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
> http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
> 



____________________________________________________________
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